Splunk Enterprise

Query events matched a value in lookup csv (regex)

lnn2204
Path Finder

Hi, I had this csv list

command_Rexcomment_remark
*uname -amalicious
*arp*malicious
*tcpdump*malicious

 

I want to search for events (it had data.command field that hold the command executed in linux server)

How can I search and filter out those event matched 1 of those regex in the list?

0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

If you have that CSV file, then you should create a lookup DEFINITION that is using that CSV - then make the advanced option 

WILDCARD(command_Rex)

and then in your SPL

| lookup definition_name command_Rex as data.command OUTPUT comment_remark

This assumes that your event field 'data.command' that contains a string that is to be matched against the command_Rex, which contains wildcards - so this will do a wildcard match - NOT a regex.

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

If you have that CSV file, then you should create a lookup DEFINITION that is using that CSV - then make the advanced option 

WILDCARD(command_Rex)

and then in your SPL

| lookup definition_name command_Rex as data.command OUTPUT comment_remark

This assumes that your event field 'data.command' that contains a string that is to be matched against the command_Rex, which contains wildcards - so this will do a wildcard match - NOT a regex.

 

lnn2204
Path Finder

in my csv file, I have this to check

*\.shtest

 

tried your suggestion, but I the comment_remark wasn't added to the events, I had a lot of events run .sh file

lnn2204_0-1692262056786.png

 

0 Karma

lnn2204
Path Finder

I understood why it happened. Thank you a lot

Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...