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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...