Splunk Search

Why would a basic substring search fail?

manus
Communicator

These two searches don't return the same thing, and I think they should. The first one returns nothing, the second one returns some events.

Search1:

index=abc toto3

Search2:

index=abc _raw=*toto3*

In other words, clearly I have some events which contain toto3. Search2 proves it, but they are not returned by search1 when I would expect them to be. Does anybody know how this can be possible?

Tags (2)
0 Karma

wpreston
Motivator

A search like this:

index=abc toto3 

does not perform a substring search. It performs a search for a word (technically a segment) that is equal to "toto3", as in toto3 is in my event. To perform a substring search in Splunk, you use the wildcards like your second search or like what @sanjay.shrestha posted:

index=abc *toto3*

This finds toto3 when it is inside a segment but does not make up the complete segment, like toto3isin my event.

So the answer to your question is that the substring search is not failing. index=abc toto3 is not a substring search, but index=abc *toto3* is.

sanjay_shrestha
Contributor

Can you try:

index=abc "toto3"
0 Karma

manus
Communicator

yes that's returns some events too. Like Search 2 does.

0 Karma

manus
Communicator

That doesn't return anything, like search 1.

0 Karma

sanjay_shrestha
Contributor

I think toto3 is not a complete word. So you can try

 index=abc "*toto3*"
0 Karma

sanjay_shrestha
Contributor

When toto3 was used; splunk looks for single word toto3.

0 Karma

manus
Communicator

yes it looks like it does that, indeed, but it's not supposed to that.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...