Splunk Search

How to show only top 10 records while using inputlookup csv file

ramani2383
New Member

index="logmon_logs" |top useother=f limit=10 CHKOUTErrorMSG by _time|timechart count by CHKOUTErrorMSG |inputlookup append=t chkouterrorNew.csv | sort -_time | outputlookup chkouterrorNew.csv

Above is the query I'm using to display a chart. My goal is in last 24 hrs time line what's the top 10 CHKOUTErrorMSG(this is field extractor).
Now, what is happening instead of showing only top 10 error message, the error message is getting appended and the error count is getting increased over the time. Can you please help me?

Tags (1)
0 Karma

diogofgm
SplunkTrust
SplunkTrust

If the lines you want get from the csv is the top you and do it like you have but in the inputlookup use also the "max" and "start" arguments. If not, instead of appending via the inputkooup, try to use the append [subsearch] command to get the csv data, filter it and then appending it.
something like:

index="logmon_logs" |top useother=f limit=10 CHKOUTErrorMSG by _time|timechart count by CHKOUTErrorMSG| append [|inputlookup chkouterrorNew.csv | <whatever you want to filter>]| sort -_time | outputlookup chkouterrorNew.csv
------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...