Splunk Search

Convert Number of days into years

khojas02
Engager

Hello Everyone!!

I have a sample data as below
Analyst Span
A 1049d 00h 00m
B 430d 01h 00m
C 225d 05h 00m

I would like to add one more column which basically convert the span column into number of years. Here d suggests number of days, h suggests an hour and m suggests minute in the Span column. Thanks in advance!!

Tags (2)
0 Karma

anmolpatel
Builder

@khojas02
does this give you whats needed? check from the rex command onwards

| makeresults
| eval _raw = "Analyst, Span
A, 1049d 00h 00m
B, 430d 01h 00m
C, 225d 05h 00m"
| multikv forceheader=1
| rex field=Span "(?<days>\d+)d\s(?<hours>\d+)h\s(?<min>\d+)m"
| eval years = floor(days / 365), months = floor((days - (years * 365)) * 0.0329), days = days - ((years * 365) + (months * 30.4167))
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, ...