Dashboards & Visualizations

How to handle HEX within fields

splunker1981
Path Finder

Hi everyone,

Trying to figure out the best way to tackle two issues - both of which are related to one logsource.

I have mail logs which logs attachment names like what is shown below.
"This=20is=20a=test.pdf"

What is the best way to handle this? Is there a way to take care of this when ingesting the log data or is the better approach to do this at search time? I wan to be able to run a search for attachment_name="This is a test.pdf" which I can't see to do right now without ensuring that I include the HEX values for certain characters.

My other question also related to the same log source. Following the recommend settings for cim compliance the name and the extension get logged in two separate fields. What's the best way to handle this during searches so I can, again, search for the exact filename including extension?

Right now what I've been doing is something like:
searchHere (attachment_name="This=20is=20a=test" AND filetype="pdf")

What I'd like to be able to do is:
searchHere attachment="This is a test.pdf"

What is the recommended solution for this? Should an additional field be created which combines both values or is there a good way to do this at searchtime?

Thanks for all the help!

Tags (1)
0 Karma
1 Solution

jbjerke_splunk
Splunk Employee
Splunk Employee

Hi splunker1981

You can join two fields with the eval command. You can do this directly in the search bar or add it to the automatically calculated fields. under Settings->Fields

The command would look like:
YOURSEARCH | eval attachment=filename.filetype

For the HEX conversion, there is an app in the app store that adds some additional functions to the Splunk search language.

DECRYPT
https://splunkbase.splunk.com/app/2655/

With this app you should be able to decode this at search time with a search command like this:

| decrypt f=attachement_name unhex

Let me know how you get along.

j

View solution in original post

jbjerke_splunk
Splunk Employee
Splunk Employee

Hi splunker1981

You can join two fields with the eval command. You can do this directly in the search bar or add it to the automatically calculated fields. under Settings->Fields

The command would look like:
YOURSEARCH | eval attachment=filename.filetype

For the HEX conversion, there is an app in the app store that adds some additional functions to the Splunk search language.

DECRYPT
https://splunkbase.splunk.com/app/2655/

With this app you should be able to decode this at search time with a search command like this:

| decrypt f=attachement_name unhex

Let me know how you get along.

j

splunker1981
Path Finder

Thanks that was just what I was looking for.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...