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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...