Splunk Search

regex operator in Splunk is not working to match results

vatsalyay
New Member

I am writing a code to simply match a regex in my search to match index field which matches app1_, app2_, etc

However my search below works

| eventcount summarize=false index=app1_*| dedup index
But when I use it like below it doesn't, it would be required to be done using regex since I would like to use an "OR" in the regex:

| eventcount summarize=false |regex index="app1_*"| dedup index

Tags (2)
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

Hello @vatsalyay,

I'm afraid app1_* will search for app1_, app1__, app_____, etc. Search command use * as wildcard but regex is different. To do the same in regex you might require to use app1_.* , where . means any characters and * means any number of occurrence.
Test your regex more here - https://regex101.com/

Hope this helps!!!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The regex command requires uses regular expressions to match the specified field value. It's not the same as the pattern used for matching in the eventcount command. What you have in your example is a valid regular expression, but calls for the letters "app1" followed by zero or more underscores. You probably want "app1_.", which is the regex equivalent to the pattern "app1_*" in the first code sample.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...