Splunk Search

Extract a substring and filter the results based on the extracted substring from incoming logs

Communicator

I am pretty new to Splunk and finding a way to figure out below:
My incoming logs have a field message which contains String formatted value. e.g.

message="OVERALLRESPONSETIME=43ms"
message="Correlation_id=123123hewgadkksksk"

Now I want to filter out messages which don't contain OVERALLRESPONSETIME as a String and also extract OVERALLRESPONSETIME as a field. I am looking for a single Eval expression to do so.

TIA

0 Karma

SplunkTrust
SplunkTrust

I'm not sure one can do that with a single eval. Try this query. The regex command filters out events that don't contain OVERALLRESPONSETIME and the rex command extracts OVERALLRESPONSETIME as a field.

... | regex message!="OVERALL_RESPONSE_TIME=\d+ms" | rex field=message "OVERALL_RESPONSE_TIME=(?<responseTime>\d+)" | ...
---
If this reply helps you, an upvote would be appreciated.
0 Karma