Getting Data In

Is there a better way to convert the age output into a more readable format (i.e. days)?

kppradhan
New Member

Hello,

I'm attempting to track AWS related password events in my Splunk.

I am sifting through my index and receiving the data I need -- however I am having an issue with converting the "age" from a unix based notation.

I am using the following to determine the age of passwords:

| eval age =_time   

My output is as follows:

PasswordLastUsed                                                                            age
018448995162    user    2020-02-14T20:49:08+00:00   1585319203
018448995162    user    2020-02-13T16:59:30+00:00   1585319203

Is there a better way to convert the age output into a more readable format (i.e. days)?

Thanks,

  • Kiran
0 Karma

woodcock
Esteemed Legend

Like this:

... | eval age = now() - _time
| fieldformat age = tostring(age, "duration")
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The _time field is the date and time when the event occurred. It's probably not the best choice for password age.

That said, use the strftime function to make epochs readable.

... | eval age = strftime(_time, "%Y-%m-%d %H:%M:S")

You can use the convert command, instead.

... | convert timeformat="%Y-%m-%d %H:%M:S" ctime(_time) as age
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...