Splunk Search

Map command to append value

astatrial
Contributor

Hello all,
I have a lookup table with saved searches names, search strings, time range and some other values.
I am trying to use inputlookup to get the content of the lookup, and then to run map command which will run the saved search and append the result (count.)
Like this:

| inputlookup lookup_file.csv
| map search="| savedsearch $search_name$"

This removes all the other results.

Does anyone knows how to add the results (in order), to every row (not to insert the lookup, just to append it to the inputlookup results).

Thanks!

Tags (2)
0 Karma

koshyk
Super Champion

Sorry, why are you doing like this rather than putting the searches within savedsearches.conf? this means you cannot get the full potential of your saved-searches or automation which comes up with Splunk and scheduling functionality etc.

If you really need to maintain a single CSV and version control, then the idea for large scale automation is

  1. Maintain your CSV file with savedsearches name, search, cron_schedule (basically all required parameters from savedsearches.conf)
  2. Then using an orchestrator software (like Ansible or script of your own), populate the savedsearches.conf automatically
  3. Then just copy the savedsearches.conf into your Splunk installation on a regular basis/deployment/releases.

Using map command and running each savedsearches is very primitive and would lead to inconsistent results or less flexibility like time parsing.

0 Karma

astatrial
Contributor

Hi,
I am not sure if i understood you.
I created all the saved searches in advance. (So it means they will be added to the savedsearches.conf no ? ).

I just use the lookup to call the name of the saved search and than i run it with the command | savedsearch . But i want to leave the name of the searches beside the result.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...