Splunk Search

How to generate a search that will only display results where a field contains some non-alphanumeric characters?

drinkingjimmy
Explorer

A field is named product. I want to produce a list of products in my source, which are not made up of only english alphanumeric characters (any length).
I.e. Products:
Dog Collar
18 inch Dog Collar
20-inch Dog Collar
Ƨhock collar

would yield only:
20-inch Dog Collar
Ƨhock collar

(Because of the latin character and the hyphen.)

I've seen plenty of uses of sed to remove/replace the non-alphanumerics, but I don't want to remove, just get a list of the outliers.

0 Karma
1 Solution

somesoni2
Revered Legend

Try like this. First two lines are to generate sample data. You need to replace that with your search.

| gentimes start=-1 | eval Product="Dog Collar#18 inch Dog Collar#20-inch Dog Collar#Ƨhock collar" | table Product | makemv Product delim="#" | mvexpand Product 
| regex Product!="^[A-z\s0-9]+$"

This will keep events which have Product with any non-alphanumeric character.

View solution in original post

somesoni2
Revered Legend

Try like this. First two lines are to generate sample data. You need to replace that with your search.

| gentimes start=-1 | eval Product="Dog Collar#18 inch Dog Collar#20-inch Dog Collar#Ƨhock collar" | table Product | makemv Product delim="#" | mvexpand Product 
| regex Product!="^[A-z\s0-9]+$"

This will keep events which have Product with any non-alphanumeric character.

Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...