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
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...