Splunk Search

Need to extract elapsed time

vipulg83
New Member

hi,

I have a query with the below mentioned resultset

logger: com.optum.bh.benefit.plan.api.BhBenefitPlansResource
message: bhben-plan-api:bHPlanView(), env=prod packageId = 1438939 timeUsed(ms) = 19
properties: { [+]
}
severity: DEBUG
thread: http-nio-8080-exec-5
}
Show as raw text
host = hec-splunk.optum.commessage = bhben-plan-api:bHPlanView(), env=prod packageId = 1438939 timeUsed(ms) = 19source = bhwebservice.logsourcetype = cba_shared_components:scwebservice:error_log

Need to extract timeUsed(ms) field so that I can build a table for the elapsed time for the requests

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This should do it.

... | rex "timeUsed\(ms) = (?<timeUsed>\d+)"
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This should do it.

... | rex "timeUsed\(ms) = (?<timeUsed>\d+)"
---
If this reply helps you, Karma would be appreciated.
0 Karma

vipulg83
New Member

Error in 'rex' command: Encountered the following error while compiling the regex 'timeUsed(ms) = (?\d+)': Regex: unmatched closing parenthesis

0 Karma

vipulg83
New Member

was able to build a dashboard guys, thanks for your help

rex "timeUsed(ms) = (?<timeUsed>\d+)"|table timeUsed | eval timeUsedBucket=case(timeUsed<=100,"0-100ms",timeUsed<=200,"101-200ms",timeUsed<=500,"201-500ms",timeUsed<=1000,"501-1000ms",timeUsed<=5000,"1001-5000ms",1==1,"above 5000ms")| stats count by timeUsedBucket

0 Karma

richgalloway
SplunkTrust
SplunkTrust

That error message usually means there's a missing backslash \\.

---
If this reply helps you, Karma would be appreciated.
0 Karma

vipulg83
New Member

Done, thanks

index=cba_shared_components timeUsed(ms)| rex "timeUsed(ms) = (?\d+)"|table timeUsed

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use backticks to keep the system from eating your code.
If your problem is resolved then please accept the answer to help future readers.

---
If this reply helps you, Karma would be appreciated.
0 Karma

to4kawa
Ultra Champion

you fix it

0 Karma

vipulg83
New Member

Updated it a bit

rex "timeUsed(ms) = (?\d+)"

0 Karma

vipulg83
New Member

Done, thanks

index=cba_shared_components timeUsed(ms)| rex "timeUsed(ms) = (?\d+)"|table timeUsed

0 Karma

vipulg83
New Member

working on that

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...