{"level":"error","app":"my-app","component":"my-component","message":"my-message"}
I have plenty of log messages like this one above.
In order to select such events in Splunk Search, I use the query below (the names have been changed but the idea is the same):
index="my-index" app="my-app" message="my-message" component="my-component"
| stats count
For a reason I don't understand, this query returns 0 rows which doesn't make any sense unless I misunderstand the syntax. Strangely enough, component
is the only field that behaves this way. There are many more fields in my log messages and adding as many of them as I want using the same ... field1=value field2=value
syntax works fine.
The query works, however, with either |where component IN ("my-component")
or |spath component | search component="my-component"
.
I would think that my syntax is wrong but it only returns strange results with one of the fields. What could be wrong in this case?
Update:
It's also interesting how the query below returns a valid breakdown of events by component
:
index="my-index" app="my-app" | stats count by component
The query below, however, still returns 0.
index="my-index" app="my-app" component="my-component" | stats count by component