I have search I'm running to change the status of a particular error that is a false negative:
index=wertyu sourcetype=audit "No valid format *"
| eval status = if(other=="No valid format*","SUCCESS",status)
| stats count latest(status) as status, latest(other) as other by FOO
I'm still seeing FAILED as the status rather than success, and am not quite sure what's wrong here.
Any insights would be greatly appreciated.
I'm not sure why you're testing to see if "No valid format" is present when you've told Splunk to only return events with that text.
That said, try this.
... | eval status = if(match(other,"No valid format%"),"SUCCESS",status) | ...
I'm not sure why you're testing to see if "No valid format" is present when you've told Splunk to only return events with that text.
That said, try this.
... | eval status = if(match(other,"No valid format%"),"SUCCESS",status) | ...
Yes! This worked:
index=wertyu sourcetype=audit "No valid format*" earliest=-5d
| eval status = if(match(other,"No valid format\.*"),"SUCCESS",status)
| stats count latest(status) as status, latest(other) as other by FOO
Thank you!
Glad to hear it. Please accept the answer.
Sure thing - here is a friendly sample of the log file:
2015-11-04T13:20:34.319 -0500,1,{host=host},{BP|InvoiceAudit|STATUS ,[CODE]::No valid format for FOO.-
We use extractions before parsing the data, so any string in that placement is stored in the other field.
Also, we know it works since I am able to populate the results in the searches above. The weird thing here is that the status isn't changing.
Any thoughts?
I confused the match
syntax with the like
syntax. One of these should work for you.
... | eval status = if(like(other,"No valid format%"),"SUCCESS",status) | ...
or
... | eval status = if(match(other,"No valid format\.*"),"SUCCESS",status) | ...
Thanks - I am testing to make sure that the search results are accurate before broadening the scope of the search. Why not test this on data I know should give me what I would expect first?
Unfortunately, I am still seeing FAILED as status rather than SUCCESS:
index=wertyu sourcetype=audit "No valid format*"
| stats count latest(status) as status, latest(other) as other by FOO
| eval status = if(match(other,"No valid format%"),"SUCCESS",status)
Can we see a sample of your data? Have you verified the other
field contains the target text?
Hello
No valid format *
is different from No valid format*
(there is no blank between the t and *).
Regards
Thanks - this did not make a difference in the results.
It will not make a different as long as a non-word character is trailing. Those are caught as punctuations. But remember, you might not notice that its no difference, but the result set could be different.
For example:
"no valid format" will match results that contain the string "no valid format/" but not "no valid format ".
Make sense?