Splunk Search

tstats and regex usage

sathiyamoorthy
Explorer

Executed a tscollect with two fields 'URL' and 'download size', how to extract URLs which matches particular regex.

It's straight forward to filter using regex when processing raw data as ( fields are already defined):

sourcetype="access_data" | regex URL="http://certain-type-only.*blah" | eval ...

How to do the same with tstats ? Tried replacing sourcetype section with tstats but it didn't work, is it possible to use regex in where column or any other method?

Tags (3)
0 Karma

okrabbe_splunk
Splunk Employee
Splunk Employee

You can filter using the tstats command.

| tstats avg(size) from ts_namespace where URL="http://certain-type-only.*blah" groupby URL

When you generate tsidx files you need to access them using tstats.

Note, I did at first try using match because the docs claim that the "where" syntax is the same as general search but this does not appear to be true.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...