CREATE VIEW surveilr_osquery_ms_node_uptime AS
SELECT
json_extract(l.content, '$.surveilrOsQueryMsNodeKey') AS node_key,
l.updated_at,
json_extract(l.content, '$.hostIdentifier') AS host_identifier,
json_extract(l.content, '$.columns.days') AS days,
json_extract(l.content, '$.columns.hours') AS hours,
json_extract(l.content, '$.columns.minutes') AS minutes,
json_extract(l.content, '$.columns.seconds') AS seconds,
json_extract(l.content, '$.columns.total_seconds') AS total_seconds
FROM uniform_resource AS l
WHERE l.uri = 'osquery-ms:query-result'
AND json_extract(l.content, '$.name') = 'Server Uptime'
ORDER BY l.created_at DESC