Splunk Search

Can these three searches be combined and ran sequentially?

ankithreddy777
Contributor

I have a scenario, where I need to
1) append results to .csv file.
2) Once I get csv file updated, I need to eliminate duplicate results from csv file and
3) performing lookup with the csv file

I am running three queries for this and scheduling accordingly everyday for sequence operation.
Can we merge three queries in to one query so that first operation is followed by second and then followed by third.

ex: net query= query1 +query2 +query3 so that query 3 should execute after 2 and 2 should execute after 3.

It will help me in case if schedular skips query2 I may not get right results. So If query's are combined I can always get correct results.

0 Karma

DalJeanis
Legend

The first two can be done as a single query without a doubt. use this if you don't need to report the days results by itself

your search language
| inputcsv append=t mycsv
| your dedup steps (sort + dedup or stats, whichever makes sense
| outputcsv mycsv

Use this style if the day's results have to come out as a separate report

your search language
| appendpipe [| inputcsv append=t mycsv
              | your dedup steps (sort + dedup or stats, whichever makes sense
              | outputcsv mycsv
              | where false()
              ]
 | present your results here

Alternately, if your CSV file is supposed to comprehensive, so that it includes duplicate records over time, you can combine steps 2 and three. However, you need to provide at least a pseudocode version of the final query in order for us to get the hooks right for you.

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!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

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