Splunk Search

How do I parse a text line and grab only 1 value

zkxi98m
New Member

New to splunk so don't laugh too much at this -

I have many strings that look similiar to this:

[71] 20130226.015959.650 3512.380251 RESULT success 0 entries 1 msecs

I want to be able to grab the msecs number and graph the avg per minute. I tried this:

index=blah blah blah |regex _raw="entries (?P\d+) msecs" | timechart span=1m avg(msecs)

Obviously that doesn't give me what I want. Any assistance would be most appreciated.

Tags (2)
0 Karma

Rob
Splunk Employee
Splunk Employee

Hi,

Give this a shot:

index=blah blah blah |rex field=_raw "entries (?<msecs>\d+) msecs" | timechart span=1m avg(msecs)

The regex command is for filtering results and the rex command is used for extracting values. Take a look at both commands in the docs for more info on syntax and usage.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...