Query to find the number of Osquery restarts in a day for all hosts

Query to find the number of Osquery restarts in a day for all hosts

Following query, run on Global database, would provide details on number of osquery restarts in a day (GMT)

Query

SELECT upt_hostname,

Count(0) 

FROM processes 

WHERE name LIKE 'osqueryd%'

AND upt_added 

AND upt_day = Cast(Date_format(current_date - interval '0' day, '%Y%m%d') AS INTEGER) 

GROUP BY upt_hostname 

ORDER BY 2 DESC


Note: The value of interval parameter can be changed based you which day you would want to query the data for.

            Also make sure cut and paste doesn't result in single quotes replaced by some other quotes