Splunk Search

Regex help

khajaforu
New Member

Hey Guys,

I need help to write a regex with the name upload to pull the number 3712 from the below log where 'B Sent' is ending string for all the logs.

Upload log: Successfully sent file '\servername\Projects\Cdfad\Prod\51327426.xml' (3712 B sent)

Similarly regex with the name Download to pull the number 152 from the below log (152 B received) where B received is ending

Download log: Successfully stored file at '\servername\Projects\FOI\QA\MassUpdates\F000' (152 B received)

Thank you in advance for your help.

Tags (2)
0 Karma

jconger
Splunk Employee
Splunk Employee

Something like this should work:

\((?<my_field>.*)\sB\ssent\)$

Explanation:

\( matches the '(' character
(?<my_field>.*) is the capture group
\s matches a space
B matches 'B'
\s matches a space
\) matches the ')' character 
$ anchors the regex to the end of the line

Similarly, this should work for your other example:

\((?<my_field>.*)\sB\sreceived\)$
0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...