CREATE VIEW surveilr_osquery_ms_node_available_space 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.gigs_disk_space_available') AS available_space,
json_extract(l.content, '$.columns.gigs_total_disk_space') AS gigs_total_disk_space,
json_extract(l.content, '$.columns.percent_disk_space_available') AS percent_disk_space_available
FROM uniform_resource AS l
WHERE l.uri = 'osquery-ms:query-result'
AND (
json_extract(l.content, '$.name') = 'Available Disk Space (Linux and Macos)'
OR json_extract(l.content, '$.name') = 'Available Disk Space (Windows)'
)
ORDER BY l.created_at DESC