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 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...