Splunk Search

How to incorporate metadata command in my lookup table to be able to view time offline?

chadman
Path Finder

I have a few searches I have added a lookup table to. All of them work, but one. The one below uses metadata and I'm not sure how to make it work with the lookup table. My goal it to find host that have not connected in the last 5 min.

| metadata  [| inputlookup Meeting_Rooms | fields host] | eval age = now()-lastTime | where age > 50  | convert ctime(lastTime) | eval field_in_ddhhmmss=tostring((age) , "duration") |rename field_in_ddhhmmss as "Time Offline" lastTime as "Last Time" | sort + "lastTime" | table host "Time Offline" "Last Time"

This is not getting any results. If I replace [| inputlookup Meeting_Rooms | fields host] with type=hosts it works fine, but will show all host. Any ideas how I can make this work with my lookup table?

0 Karma
1 Solution

chadman
Path Finder

I think I have it working with this.

| inputlookup Meeting_Rooms | join type=left host [metadata type=hosts] | eval age = now()-lastTime | where age > 50  | convert ctime(lastTime) | eval field_in_ddhhmmss=tostring((age) , "duration") |rename field_in_ddhhmmss as "Time Offline" lastTime as "Last Time" | sort + "lastTime" | table host "Time Offline" "Last Time"

View solution in original post

0 Karma

chadman
Path Finder

I think I have it working with this.

| inputlookup Meeting_Rooms | join type=left host [metadata type=hosts] | eval age = now()-lastTime | where age > 50  | convert ctime(lastTime) | eval field_in_ddhhmmss=tostring((age) , "duration") |rename field_in_ddhhmmss as "Time Offline" lastTime as "Last Time" | sort + "lastTime" | table host "Time Offline" "Last Time"
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...