Splunk Search

Regex not matching

jamesvz84
Communicator

I have the field devname in my raw log in the format: devname=123-fw-af-we

I am trying to write a regex string to match whenever fw is present in the field value (no matter what other characters are present in the field). However, the following is not working. Any ideas?

index=sources | regex _raw="devname=[.]+fw[.]+"
Tags (2)
0 Karma
1 Solution

jamesvz84
Communicator

I needed to use the regex command to test the regex string for another purpose.

Turns out this works (added device_id to make the regex more precise):

index=sources | regex _raw="devname=.+fw.+device_id="

View solution in original post

0 Karma

jamesvz84
Communicator

I needed to use the regex command to test the regex string for another purpose.

Turns out this works (added device_id to make the regex more precise):

index=sources | regex _raw="devname=.+fw.+device_id="

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try this (assuming devname field is extracted already)

index=sources devname="*-fw-*"
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 ...