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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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