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
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!

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 ...

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...