Splunk ITSI

How to convert Epoch time to a Month string.

Montalvolll
Explorer

I'm trying to make a table of bookings from the whole 2019, my search is working as expected except for one column.

I've made a deep search and tried with convert, rename and eval functions but none of them are working for me (at least the way I'm using them).

This is my search and the result of my table:

 

 

 

index=myIndex host=myHost confirmationNumber step_code="'BOOKING_DONE'" earliest=01/01/2019:00:00:00 latest=12/31/2019:00:00:00 | spath | timechart span=1mon count by Resort limit=0 | addtotals | addcoltotals | eval Month=strptime(_time,"%M") | table _time, 'BBO', 'BNG', 'BRP', 'BTC', 'INN', 'NGA', 'SAT', 'SBD', 'SBR', 'SEB', 'SGL', 'SGO', 'SHC', 'SLS', 'SLU', 'SMB', 'SNG', 'SRB', 'SRC', 'SWH', Total | rename _time AS Month

 

 

 

 

Montalvolll_0-1613745917546.png

PD: Also trying to add a label to the last empty row and change it's name to "Total per Resort"

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Montalvolll
Explorer

You're a very nice gentlemen my friend!

Issue is fixed

Montalvolll_0-1613749566895.png

 I just have one more issue, when I try to rename my column header, it converts it again to an Epoch time, this is my new modified search with your solution:

 

index=myIndex host=myHost confirmationNumber step_code="'BOOKING_DONE'" earliest=01/01/2019:00:00:00 latest=12/31/2019:00:00:00 | spath | timechart span=1mon count by Resort limit=0 | addtotals | addcoltotals | table _time, 'BBO', 'BNG', 'BRP', 'BTC', 'INN', 'NGA', 'SAT', 'SBD', 'SBR', 'SEB', 'SGL',	'SGO', 'SHC', 'SLS', 'SLU', 'SMB', 'SNG', 'SRB', 'SRC', 'SWH', Total | fieldformat _time=strftime(_time, "%B %Y") | rename _time AS "Month"
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

fieldformay only changes the way the field is displayed, since you renamed it, it is no longer called _time!

index=myIndex host=myHost confirmationNumber step_code="'BOOKING_DONE'" earliest=01/01/2019:00:00:00 latest=12/31/2019:00:00:00 | spath | timechart span=1mon count by Resort limit=0 | addtotals | addcoltotals | table _time, 'BBO', 'BNG', 'BRP', 'BTC', 'INN', 'NGA', 'SAT', 'SBD', 'SBR', 'SEB', 'SGL',	'SGO', 'SHC', 'SLS', 'SLU', 'SMB', 'SNG', 'SRB', 'SRC', 'SWH', Total | rename _time AS "Month" | fieldformat Month=strftime(Month, "%B %Y")

Montalvolll
Explorer

I wish you the best and only the best my dear friend!

I hope your cryptos (if you have some) pump to Mars.

Thanks!

0 Karma
Get Updates on the Splunk Community!

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...