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!

New This Month - Splunk Observability updates and improvements for faster ...

What’s New? This month, we’re delivering several enhancements across Splunk Observability Cloud for faster and ...

What's New in Splunk Cloud Platform 9.3.2411?

Hey Splunky People! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2411. This release ...

Buttercup Games: Further Dashboarding Techniques (Part 6)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...