Hi Anji,
Thanks for your help.
The data I have is basic metricbeat data for 3 systems metricbeat-1
, metricbeat-2
, and metricbeat-3
.
I have pasted an example raw json for one log line here:
{"_index":"metricbeat-7.5.2-2020.02.03-000001","_type":"_doc","_id":"PK9gdXABDxuLEUB7OTF3","_version":1,"_score":null,"_source":{"@timestamp":"2020-02-24T04:06:41.145Z","host":{"id":"33add492312d460eb3d8061e6502d713","containerized":false,"hostname":"metricbeat-1","architecture":"x86_64","name":"metricbeat-1","os":{"codename":"bionic","platform":"ubuntu","version":"18.04.4 LTS (Bionic Beaver)","family":"debian","name":"Ubuntu","kernel":"4.15.0-88-generic"}},"agent":{"type":"metricbeat","ephemeral_id":"c80e62c6-fb34-402e-8e99-4fbd634087ac","hostname":"metricbeat-1","id":"f1eed983-ed5b-43f8-b7c5-0c1ad4f7045e","version":"7.5.2"},"metricset":{"name":"memory","period":600000},"service":{"type":"system"},"system":{"memory":{"total":1033547776,"used":{"bytes":894615552,"pct":0.8656},"free":138932224,"actual":{"free":733540352,"used":{"bytes":300007424,"pct":0.2903}},"swap":{"used":{"bytes":1585152,"pct":0.0008},"free":2065154048,"in":{"pages":91},"out":{"pages":394},"readahead":{"cached":13,"pages":30},"total":2066739200},"hugepages":{"free":0,"reserved":0,"surplus":0,"default_size":2097152,"swap":{"out":{"pages":0,"fallback":0}},"total":0,"used":{"pct":0,"bytes":0}}}},"event":{"dataset":"system.memory","module":"system","duration":645037},"ecs":{"version":"1.1.0"}},"fields":{"@timestamp":["2020-02-24T04:06:41.145Z"]},"highlight":{"host.hostname":["@kibana-highlighted-field@metricbeat-1@/kibana-highlighted-field@"]},"sort":[1582517201145]}
This line is large, but the fields I care about are host.hostname
and timestamp
I have included some example data with just these fields below
{"_source":{"@timestamp":"2020-02-24T04:05:00.000Z","host":{"hostname":"metricbeat-1"}}}
{"_source":{"@timestamp":"2020-02-24T04:10:00.000Z","host":{"hostname":"metricbeat-1"}}}
{"_source":{"@timestamp":"2020-02-24T04:15:00.000Z","host":{"hostname":"metricbeat-1"}}}
{"_source":{"@timestamp":"2020-02-24T04:20:00.000Z","host":{"hostname":"metricbeat-1"}}}
{"_source":{"@timestamp":"2020-02-24T04:25:00.000Z","host":{"hostname":"metricbeat-1"}}}
{"_source":{"@timestamp":"2020-02-24T04:30:00.000Z","host":{"hostname":"metricbeat-1"}}}
{"_source":{"@timestamp":"2020-02-24T04:05:00.000Z","host":{"hostname":"metricbeat-2"}}}
{"_source":{"@timestamp":"2020-02-24T04:10:00.000Z","host":{"hostname":"metricbeat-2"}}}
{"_source":{"@timestamp":"2020-02-24T04:15:00.000Z","host":{"hostname":"metricbeat-2"}}}
{"_source":{"@timestamp":"2020-02-24T04:20:00.000Z","host":{"hostname":"metricbeat-2"}}}
{"_source":{"@timestamp":"2020-02-24T04:25:00.000Z","host":{"hostname":"metricbeat-2"}}}
{"_source":{"@timestamp":"2020-02-24T04:30:00.000Z","host":{"hostname":"metricbeat-2"}}}
{"_source":{"@timestamp":"2020-02-24T04:05:00.000Z","host":{"hostname":"metricbeat-3"}}}
{"_source":{"@timestamp":"2020-02-24T04:10:00.000Z","host":{"hostname":"metricbeat-3"}}}
These metrics are what kibana sees for the 3 systems. assuming the current time is 2020-02-24T04:31:00.000Z
I want to make a dashboard that show me host metricbeat-3
is down (has not conected to the ES server in the last 10 minutes).
I can't simply filter for timestamp now-10m/m
because all 3 hosts have a log that matches that time filter.
If I do this I end up with a table that looks like:
hostame | timestamp
metricbeat-1 | 2020-02-24T04:20:00.000Z
metricbeat-2 | 2020-02-24T04:20:00.000Z
metricbeat-3 | 2020-02-24T04:10:00.000Z
What I need to do is exclude buckets where any timestamp (the latest one) is less than now-10m/m
from the table.