Splunk Search

Regex to find log entries with Content-length: greater than 10,000 bytes.

billconnell
Engager

I have my LTM logging all the Content-length entries for all incoming requests to splunk via the HSL. My problem is trying to get all the records where the Content-length is greater than 10k

I have tried these two, but they do not work:
Content-length:\s+\d{5} and Content-length:\s+[1-9]\d{4}

If it remove the \s+\d{5} or \s+[1-9]\d{4} I see plenty of logs with larger than 10k numbers. See sample below, the text inside <> are just to make them anonymous. You will see the content length is 364k, much larger than 10k. Thanks, Bill

Nov 13 15:14:25 Virtual: , Content-length: 364009 for /perl/upload.pl host= Options| sourcetype=ltm_log Options| source=udp:514 Options

Tags (1)
0 Karma

Rob
Splunk Employee
Splunk Employee

The reason that there is a problem is because you are trying to match against a lower number instead of the number that is there. So to match against a number that is at least 5 digits in length but can be longer you can use the following regex:

\d{5}\d*
0 Karma

jonuwz
Influencer

or just \d{5,}

Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...