Splunk Search

Why is regex not returning any results when used in a tstats search?

pgort
New Member

I have a correlation search that triggers on users accessing too many URLs categorized as unknown.

| tstats allow_old_summaries=true count(Web.user) as "Count" from datamodel=Web where nodename=Web.Blocked Web.url_category="unknown" Web.rule!="Allow_Public_IP" AND Web.src_zone="TRUST" by "Web.user" 
| rename "Web.user" as "user"
| regex Web.url !="\d+\.\d+\.\d+\.\d+\/$"
| where 'Count'>100

| regex Web.url !="\d+\.\d+\.\d+\.\d+\/$" is the problem line. It does not filter out IP addresses (or anything for that matter). Right now, Cisco Spark traffic is cluttering our URL traffic logs as the "url" is an IP address with a trailing / rather than a DNS name.

I need the regex to ignore logs of just an IP followed by a slash: "10.0.0.1/" but still return all other values like: "10.0.0.1/index.html" or "google.com". I can't tell if I'm calling regex correctly for tstats or how regex sees the value of Web.url to know if I can use the $ at the end.

0 Karma
1 Solution

sjohnson_splunk
Splunk Employee
Splunk Employee

You need to add Web.url to your tstats statement as part of the by statement otherwise the field isn't available for the regex statement.

View solution in original post

0 Karma

sjohnson_splunk
Splunk Employee
Splunk Employee

You need to add Web.url to your tstats statement as part of the by statement otherwise the field isn't available for the regex statement.

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 ...