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!

3 Ways to Make OpenTelemetry Even Better

My role as an Observability Specialist at Splunk provides me with the opportunity to work with customers of ...

What's New in Splunk Cloud Platform 9.2.2406?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2406 with many ...

Enterprise Security Content Update (ESCU) | New Releases

In August, the Splunk Threat Research Team had 3 releases of new security content via the Enterprise Security ...