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!

Expert Tips from Splunk Professional Services, Ensuring Compliance, and More New ...

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

Observability Release Update: AI Assistant, AppD + Observability Cloud Integrations & ...

This month’s releases across the Splunk Observability portfolio deliver earlier detection and faster ...

Stay Connected: Your Guide to February Tech Talks, Office Hours, and Webinars!

💌Keep the new year’s momentum going with our February lineup of Community Office Hours, Tech Talks, ...