Splunk Search

How to filter out event from outbound mail log having "Attachment" field contains file extension ".txt,.html,.jpg,.png"?

Abhineet
Loves-to-Learn Everything

Looking for Splunk query to filter out event if "Attachment" field having extension .txt or .html or .jpg or .png

if only above mentioned file extension available in "Attachment" field then only it should filter out. apart from that if any other file extension available with above mentioned then wee need to consider that event.

Below mentioned is attachment field values in some of event.

Abhineet_1-1670849572980.png

 

red enclosed event should be filtered out as "Attachment" field have only ".txt",".html" and ".png".

other two event have ".txt",".html",".docx" and ".txt",".ics" these two should not filterout.

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Here's one approach.  It uses the mvfind function to see if each attachment type is present.  It then filters out the events with all three types.

...
| eval has_txt=mvfind(Attachment, "\.txt"), has_html=mvfind(Attachment, "\.html"), has_png=mvfind(Attachment, "\.png")
| where NOT (has_txt AND has_html AND has_png)

 

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

Abhineet
Loves-to-Learn Everything

This helps.. thanks

0 Karma

richgalloway
SplunkTrust
SplunkTrust

If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

---
If this reply helps you, Karma would be appreciated.
0 Karma
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 ...