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!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...