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.
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
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
Many thanks !!