Splunk Search

How to search for a string that begins with a square bracket ]?

spadler
Explorer

I have a field value like this that I want to exclude.

 

[22minfo[3: host.console[0]

 

The searches I can think of either don't do anything or return an error. Note, I am trying to speed up a search so I do not want to use regex. 

Searches I tried:

 

 

message != [*
message != "["*
message != "[*"
message != '[*'
message != '['*

 

 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

I'm wondering if there's a "hidden" ESC character before the [ that keeps your searches from matching.  Try this regex command to see if it helps.  I understand you prefer to not use regex, but if nothing else works then why not?

| regex message!="^\x1b\["
---
If this reply helps you, Karma would be appreciated.

spadler
Explorer

It's my understanding that regex doesn't speed up searches. Is that right? Because the values that start with [ are not relevant to me and take up over half the results. They are being filtered out by other regex expressions, so I don't mind them being in the results except for the impact they have on speed. 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It understood the OP as looking for ways to filter out certain events, but now you say they're already filtered.  So is the goal a "faster" way to do the filtering?  If so, have you looked at the Job Inspector to see how much time is spent doing regex?  It's probably not much compared to other parts of the job.

If there indeed is an ESC character before the [ then the only non-regex way to find it will be message != "*[*", but that will find a lot of false positives so is not useful.

---
If this reply helps you, Karma would be appreciated.

spadler
Explorer

Yes I think you're right. Using regex seems to be about as fast as doing something similar with the 'search' command or the 'where' command. I was confused about what order things should be done in for optimization. I also found the info on Parallel processing on this page useful. Thanks for your input. 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...