So, I need to compare counts over multiple days, but I also need to filter the results to only show the count difference for the current day (compared to yesterday). For some reason, I can't get Splunk to understand that "5 = 5" (today's date) so it won't filter the results. Here's a simplified version of the query that you can test:
earliest=-72h latest=now index=_internal log_level=ERROR
| stats count as ErrorCount by date_mday sourcetype
| sort sourcetype
| streamstats current=f last(ErrorCount) as LastErrorCount by sourcetype
| eval ErrorCountDiff=ErrorCount-LastErrorCount
| eval today_mday=strftime(now(), "%e")
What I want is only the rows where date_mday is equal to today_mday. However, if I add:
| search date_mday=today_mday
It returns zero results. As does:
| where date_mday=today_mday
And if I do:
| search date_mday!=today_mday
it returns ALL results (instead of just excluding today) (same result for where), so for some reason Splunk can't evaluate that both numbers are equal.
I have tried converting both fields "tostring", and both fields "tonumber", and then applying the "date_mday=today_mday" filter, but it still returns zero results.
Does anyone have an idea on how I can make Splunk understand that "5 = 5"? (today's date)
... View more