Splunk Search

search does not match token which contains file path with special characters

ToniHuynh
Explorer

Hi Everyone,

I passed a token which contain a file path with some special character into a search but it does not show any result:

 

index=wineventlog EventCode=4660 OR EventCode=4663 Account_Name!="ANONYMOUS LOGON" host="MELFP" Account_Name!="*$" 
| eval ObjectName=urldecode("D:\Company Data\HR\Payroll\HR$ (MELFP02) (P) - Shortcut.lnk") 
| eval ObjectName=replace(ObjectName,"\\\\","\\\\\\")
| where match(Object_Name,ObjectName)
| table _time host Account_Name Account_Domain Object_Name Accesses EventCodeDescription 
| sort _time desc

 

 

However, If I compare directly as below then it would show result.

 

|search Object_Name="D:\\Company Data\\HR\Payroll\\HR$ (MELFP02) (P) - Shortcut.lnk"

 

 

Not sure why because if I shows the ObjectName, it is decoded correctly as below

"D:\\Company Data\\HR\Payroll\\HR$ (MELFP02) (P) - Shortcut.lnk"

 

Labels (1)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Are Object_Name and ObjectName identical?  If not, does ObjectName contain pattern characters that would produce a match with Object_Name?

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

richgalloway
SplunkTrust
SplunkTrust

The second argument to the match function must be a valid regular expression.  While you've taken the precaution to escape the backslash characters, you must also do so with the other regex special characters such as $, (, and ..

If that's too much effort (understandable), try the like function, instead.

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

ToniHuynh
Explorer

Thanks @richgalloway but like function still does not work for me.

| where like(Object_Name,ObjectName) 
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

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 ...