Splunk Search

Split output of query into separate files

andreaswpv
Explorer

Running queries on really large sets of data, and sending the output to an outputlookup works well for weekly refreshed dashboards. Is there a way to have some numbers from the initial report go into a separate, second outputlookup for monthly tracking? 

For example a weekly report or dashboard shows me details on a daily basis, and the weekly summary - great. 
Now the weekly summary should go additionally to a separate file for the monthly view. Is there a way to 'tee' results to different outputlookups? 

Labels (1)
Tags (2)
0 Karma
1 Solution

etoombs
Path Finder

Yes, you can do this.  As you chain the outputlookups, put the most broad search first. As you summarize the different items you need, you can write to additional lookup files using append, or even bring in another file, do stats processing, and then write it back out. 

 

<run your initial search, for the daily data>

|outputlookup dailyfile.csv 

<add the fully daily info to the weekly file, or do whatever summation is necessary>

|outputlookup append=true weeklyfile.csv

<bring in existing monthly data, and summarize it. then write it back out>

|append

[|inputlookup monthlyfile.csv] 

|stats <summarize whatever>

|outputlookup monthlyfile.csv

 

 

View solution in original post

etoombs
Path Finder

Yes, you can do this.  As you chain the outputlookups, put the most broad search first. As you summarize the different items you need, you can write to additional lookup files using append, or even bring in another file, do stats processing, and then write it back out. 

 

<run your initial search, for the daily data>

|outputlookup dailyfile.csv 

<add the fully daily info to the weekly file, or do whatever summation is necessary>

|outputlookup append=true weeklyfile.csv

<bring in existing monthly data, and summarize it. then write it back out>

|append

[|inputlookup monthlyfile.csv] 

|stats <summarize whatever>

|outputlookup monthlyfile.csv

 

 

ITWhisperer
SplunkTrust
SplunkTrust

You can have multiple outputlookup commands in the same search so you can append each week's results to the monthly lookup and then inputlookup at the end of the month to process the monthly results

0 Karma
Get Updates on the Splunk Community!

Fall Into Learning with New Splunk Education Courses

Every month, Splunk Education releases new courses to help you branch out, strengthen your data science roots, ...

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...