Splunk Search

Onetime regex search

Avarion
New Member

Hi,

I'm struggling with doing a regex search.

I want to search the whole log files for credit card information. Since its not necessary in a field I want to do it as a full search.

Unfortunately I don't get Splunk to even make the easiest regex search.

For example:

index="ABC" regex _raw="INFO"
index="ABC" regex field=_raw "INFO"

result empty. INFO is in nearly every third _raw Field.

It does not change when I exchange regex with rex.

I'm sure its something very simple unfortunately I seem to be unable to find it.

Tags (2)
0 Karma

Avarion
New Member

Ah, Thank you. I've searched for examples before but they were all missing the Pipe character.

I understand your concerns. But the INFO was only a example. I will add there the regex for the credit card search.

0 Karma

Avarion
New Member

Ah, Thank you. I've searched for examples before but they were all missing the Pipe character.

I understand your concerns. But the INFO was only a example. I will add there the regex for the credit card search.

0 Karma

Ayn
Legend

It seems to me you should take the Splunk search tutorial (http://docs.splunk.com/Documentation/Splunk/latest/SearchTutorial/WelcometotheSearchTutorial ). The searches you're running now are looking for the literal string "regex". You could do

index="ABC" | regex _raw="INFO"

which is probably what you were after, but that would have horrible performance, because it would tell Splunk to grab ALL events in the index ABC from disk before passing them on to the regex command. It would be MUCH better to do

index="ABC" INFO

because that would make Splunk grab only the events that actually contain the word "INFO" from disk. Always try to put as many terms in your base search as possible - it enables Splunk to limit the events that need to be read from disk, which leads to better performance.

Avarion
New Member

Ah, Thank you. I've searched for examples before but they were all missing the Pipe character.

I understand your concerns. But the INFO was only a example. I will add there the regex for the credit card search.

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH ON-DEMAND NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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