Splunk Search

Count Occurrence of string from raw log

andreacorrie
Explorer

I am trying to count occurrences of events from raw logs. Basically, if the log contains the string "MediaFailed", then count it. The difficulty is this string is not part of a key-value pair so I can't do an equality statement. I'm just looking for its existence within the entire log. I have tried the following, unsuccessfully:

| eval failures=case(match(_raw,"MediaFailed"),uuid)

Any help is appreciated!

Tags (3)
0 Karma

somesoni2
Revered Legend

Something like this would work?

| eval failures=if(match(_raw,"*MediaFailed*"),1,0)
0 Karma

cpetterborg
SplunkTrust
SplunkTrust

You can just use the string "MediaFailed" as a part of your search, something like:

source=<whatever> "MediaFailed" | stats count

That will search it matching the case.

0 Karma
Get Updates on the Splunk Community!

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...