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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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