Splunk Search

Comparing one value of a field from a search with all the values of a field in other search.

allan_newton
Path Finder

Hi,

I have come across a situation where I have to compare a set of values for a field with one value for another field (Both represent time), and display Yes/No as values for a new field.

Search one should give me a field "Latest_Time" with only one value and it should be compared with other field "Gen_Time" in other search and create a new field "Checked" with possible values "Yes/No" if the "Latest_Time" is less than "Gen_Time" the value for "Checked" is "Yes" else "No".

Please help.

Tags (3)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Okay... something like this?

index=foo sourcetype=bar (Error_Message=* OR Success_Message=*) | eval message_type = if(isnotnull(Error_Message), "error", "success") | eval dummy = "dummy" | chart latest(_time) over dummy by message_type | eval checked = if(success > error, "Yes", "No") | fields checked

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Okay... something like this?

index=foo sourcetype=bar (Error_Message=* OR Success_Message=*) | eval message_type = if(isnotnull(Error_Message), "error", "success") | eval dummy = "dummy" | chart latest(_time) over dummy by message_type | eval checked = if(success > error, "Yes", "No") | fields checked
0 Karma

allan_newton
Path Finder

It was really helpful.

0 Karma

allan_newton
Path Finder

2014-04-21 06:39:38 Message="Error Server connection failed on 8346 port.
2014-04-21 06:41:59 Port opened, connection successful
2014-04-21 07:22:34 Message="Error Server connection failed on 8346 port.
2014-04-21 07:25:32 Port opened, connection successful.
I have two types of events, I have rexed and extracted the fields, Error_Message & Success_Message. So now i have to find the latest time where "Port opened, connection successful" and check with the all the Error_messages.
If latest success message is after error message, action taken is "Yes".
Table Time, Error_Message action_taken

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Do post some sample events.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...