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!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...