Monitoring Splunk

Heavy query

spillo491
New Member

Hi,

I have a problem with this query executed on 3 months

index="app" host="sl0920*" source="/home/java/jboss-eap-6.2/app/log/teller-web.log" OR source="/home/java/jboss-eap-6.2/app/log/desktop-web.log" priority="FATAL" category="AUDIT*" message="{Invoking*" | eval date = strftime(_time, "%Y-%m-%d") | stats count as Contatore by message,correlationId,date | where Contatore > 1 | eval tot = Contatore/2 | chart sum(tot) as tot by date

Is it possible rewrite the same query with a query with better performances please ?

Tags (1)
0 Karma

DalJeanis
Legend

I don't see anything obviously bad about the code. When possible, you want to avoid reformatting data at the event level before the data is summarized, and a numeric field (or epoch time field) is more efficient for summary than a display field, but you at least need to bin the _time at the 1d level, so we can't avoid a reformat completely.

Try this, and see what happens. There might be a marginal improvement.

 index="app" host="sl0920*" (source="/home/java/jboss-eap-6.2/app/log/teller-web.log" OR source="/home/java/jboss-eap-6.2/app/log/desktop-web.log") priority="FATAL" category="AUDIT*" message="{Invoking*" 
| table _time, message, correlationId
| bin _time as date  span=1d
| stats count as Contatore by message, correlationId, date 
| where Contatore > 1 
| eval tot = Contatore/2
| eval date = strftime(_time, "%Y-%m-%d")  
| chart sum(tot) as tot by date

I'm tempted to try a timechart version, but without your data, I have no way of knowing if it would get better results.

0 Karma

spillo491
New Member

Sorry but this query doesn't extract any results

0 Karma

niketn
Legend

@spillo491... do you get any result when you run 1st 4 lines of DalJeanis' code?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

spillo491
New Member

Yes, I get results !

0 Karma

niketn
Legend

On a different thought... If you have too many events to be handled in 30 days... You can actually try summary index.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...