Splunk Search

Is it possible to define multiple evals as default for each search?

HeinzWaescher
Motivator

Hi,

I would like to know whether it is possible to perform something like this per default for each and every search in the background:

| eval _raw=split(_raw, user)
| eval user_hash=sha256(user)
| eval _raw=mvjoin(_raw, user_hash)

Thanks in advance

Tags (2)
0 Karma

adonio
Ultra Champion

before i go further, your search is very heavy as it calculates all data and hashes user, if you want to mask the user field, you can do it at index time with props.conf and tranforms.conf also, check out the new feature in Splunk 8.0 around work with data before its indexed
i think the closest to what you are after is: "search filters" however, although they have some downsides,
read here:
https://docs.splunk.com/Documentation/Splunk/8.0.0/Security/Addandeditroles#Specify_search_restricti...
there is another doc that i cant find at the moment.
regardless, i think that what @kamlesh_vaghela suggested (macros) is a better solution, as you will can also put variables in them and they are knowledge objects and not roles configuration.

hope it helps

to4kawa
Ultra Champion

If you know the user,

user user_hash

It would be nice to create a CSV with the value of and auto lookup

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@HeinzWaescher

I think it is not possible. But to achieve this, you have to create a macro with below search which can be use in all searches.

| eval _raw=split(_raw, user)
| eval user_hash=sha256(user)
| eval _raw=mvjoin(_raw, user_hash)

Like:

search index=main `my_macro`

https://docs.splunk.com/Documentation/Splunk/7.3.2/Knowledge/Definesearchmacros

HeinzWaescher
Motivator

I thought about using macros. But I would like have a solution that the user don't have to use actively.
It should be done by default for a defined role.

0 Karma
Get Updates on the Splunk Community!

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

March Community Office Hours Security Series Uncovered!

Hello Splunk Community! In March, Splunk Community Office Hours spotlighted our fabulous Splunk Threat ...

Stay Connected: Your Guide to April Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars in April. This post ...