Splunk Search

Eval If Multiple Date Values Match or Do Not Match

Razziq
Explorer

Hello,

I have a script gathering the last updated timestamp of three different files and I'm ingesting that data into Splunk to help identify when one of the three files fails to update.  What I am trying to do is build a dashboard table view of all of the dates and eval any that do match the others as "Not_Matching".

In the below screenshot i'd like to identify Servername2.file as "Not_Matching" (since it has a Timestamp of 2022-01-21 12:XX, instead of 2022-01-21 15:XX like the other two files) using an eval statement if possible. Note that all three files live within the same Index/Source/Sourcetype.

Razziq_0-1642818193299.png

Thanks for any help!

Labels (2)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

The question needs more clarification.  If every search returns exact three (3) results with a Timestamp field that can be precisely compared (i.e., no rounding into minutes or such), you can simply mark any "oddball" as not  matching.

| stats values("HostFile") as Files by Timestamp
| eval Match = if(mvcount(Files) > 1, "Matching", "Not matching")

Even in this simplistic scenario, you need to decide how to handle cases when all three files carry different Timestamp.  The above method says "Not matching" when this happens.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...