Splunk Search

How do you add a field to your search result that calculates current input lag?

Marinus
Communicator

It would be useful if you could add a field to your search results that indicates for that particular source how behind it is.

input_lag = convert_to_seconds( "date/time of the last event for the source" - "current date/time")

This can be very useful it you don't have a real time feed i.e. monitor.

1 Solution

imrago
Contributor

Suggestion:

source=somesourcename | head 5 | eval duration=(now() - [search source=somesourcename | head 1 | fields + _time | rename _time as search])

The subsearch part returns the _time of the last event in that source.

View solution in original post

0 Karma

rshoward
Path Finder
0 Karma

Johnvey
Contributor

To see the lag time of the most recent event:

source=FOO | head 1 | eval lag_time = _indextime - _time

If you are running 4.1, you can use real-time search to decorate each event with its own lag time:

source=FOO | eval lag_time = time() - _time

or generate a distribution of lag times over some time period (by choosing a real-time window from the time picker):

source=FOO | eval lag_time = round(time() - _time, 1) | chart count by lag_time

imrago
Contributor

Suggestion:

source=somesourcename | head 5 | eval duration=(now() - [search source=somesourcename | head 1 | fields + _time | rename _time as search])

The subsearch part returns the _time of the last event in that source.

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...