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.

Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...