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

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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...