Dashboards & Visualizations

X axis per month with average

Lucie99
Explorer

Hi you all,

I'm very new on Splunk and I'm trying to learn the SPL code.

Pour le moment j'ai un graphique qui a dans l'axe X la date (JJ / MM / AAAA en désordre) et dans l'axe Y une valeur. Je veux savoir comment puis-je classer l'axe X dans l'ordre chronologique par mois et réaliser la moyenne de toute la valeur par mois?

For the moment I have a graphic that has the date in the X axis (DD/MM/YYYY in disorder) and Y axis the value. I want to know how can I sort the X axis in the chronogical order per month and realize the average of all the value per month ?

Thanks you for your help.

 

screen.PNG

Labels (1)
0 Karma
1 Solution

to4kawa
Ultra Champion

sample:

| gentimes start=1/1/2019 end=1/1/2020
| rename starttime as _time
| rename COMMENT as "this is sample, from here the logic."

| bin _time span=1month
| eval date=strftime(_time,"%d/%m/%Y")
| eval count=random() % 100
| stats avg(count) as count by _time date
| table date count

recommend

your search
| eval _time=strptime(DateJour,"%d/%m/%Y")
| bin _time span=1month
| eventstats avg(May) as avgMay by _time
| eval _time=strptime(DateJour,"%d/%m/%Y")
| sort _time
| eval criticalmin = -2 ,criticalmax = 2
| table DateJour May avgMay criticalmin criticalmax

View solution in original post

to4kawa
Ultra Champion

sample:

| gentimes start=1/1/2019 end=1/1/2020
| rename starttime as _time
| rename COMMENT as "this is sample, from here the logic."

| bin _time span=1month
| eval date=strftime(_time,"%d/%m/%Y")
| eval count=random() % 100
| stats avg(count) as count by _time date
| table date count

recommend

your search
| eval _time=strptime(DateJour,"%d/%m/%Y")
| bin _time span=1month
| eventstats avg(May) as avgMay by _time
| eval _time=strptime(DateJour,"%d/%m/%Y")
| sort _time
| eval criticalmin = -2 ,criticalmax = 2
| table DateJour May avgMay criticalmin criticalmax

Lucie99
Explorer

Many thanks !!

0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...