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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...