Splunk Search

Is it possible to increment values time after time ?

RomainH
New Member

Hi there,

Because of some product limitations on a SMTP server, I need to desactivate snmp polling but I have to keep an eye on the mail queue growth.

The server is sending real time logs to splunk via syslog and I already identified fields to find out if a mail has just been queued, or if it has been delivered from queue.
My problem is what I get is the current value, and not the sum of the queue size.

Is there a way to add the new value with previous result (by minute) and graph it in a timechart to get a representative view of the queue size ?

secondarily, I cant get to substract the out value from the IN, here's my code:

| eval queuein=case(stat == "Deferred:", "FILL IN") 
| eval queueout=case(stat == "Sent", "FILL OUT")
| eval queue=queuein-queueout

If anyone could help me with that, I'd really appreciate.
Regards,
Romain.

Tags (1)
0 Karma
1 Solution

chris
Motivator

If you want to display the stats per minute the following search might work:

<basesearch> | eval counter=if(stat="Deferred:",1,-1) | timechart span=1m sum(counter)

If you want to see how the queue size develops over time:

<basesearch> | eval counter=if(stat="Deferred",1,-1) | reverse |streamstats sum(counter) as running_count | timechart span=1m avg(running_count) min(running_count) max(running_count) 

You will only see how the queue changes over time since we do not know the initial size of the queue.

If this does not help, can you post some sample logs?

Chris

View solution in original post

0 Karma

chris
Motivator

If you want to display the stats per minute the following search might work:

<basesearch> | eval counter=if(stat="Deferred:",1,-1) | timechart span=1m sum(counter)

If you want to see how the queue size develops over time:

<basesearch> | eval counter=if(stat="Deferred",1,-1) | reverse |streamstats sum(counter) as running_count | timechart span=1m avg(running_count) min(running_count) max(running_count) 

You will only see how the queue changes over time since we do not know the initial size of the queue.

If this does not help, can you post some sample logs?

Chris

0 Karma

chris
Motivator

You're welcome.

0 Karma

RomainH
New Member

Hi Chris,

Thank you this is just perfect !

Regards.
Romain

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...