Alerting

How to calculate the age of an alert from an inputlookup time field?

splunksurekha
Path Finder

I have a input lookup file called agingalertreport. The content looks like this.

|inputlookup agingalertreport

alerttime                  alertname    hostname
Mon Aug 17 04:55:02 2015    Space Low   vsa116122 

Now I want to create another column called age which will calculate and give me the age of the alert according to today's date, telling how many days or months old this alert is.

Can someone help me with the search?

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Here's one way to get the age in days.

... | eval age=(now() - strptime(alerttime,"%a %b %d %H:%M:%S %Y"))/86400 | ...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Here's one way to get the age in days.

... | eval age=(now() - strptime(alerttime,"%a %b %d %H:%M:%S %Y"))/86400 | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma

splunksurekha
Path Finder
|inputlookup agingalertreport| eval age=(now() - strptime(alerttime,"%a %b %d %H:%M:%S %Y"))/86400

alerttime   alertname   hostname
Tue Sep 1 05:37:21 2015     FTP Port is not responding on MO-57CCC8504.dc18.saas.sap.corp   MO-57CCC8504.dc18.saas.sap.corp
Mon Aug 24 10:32:36 2015    DMZ Server - GLOBALSCAPE Process is not running dc15sftpdmz01.sha.sf.priv   dc15sftpdmz01.sha.sf.priv
Mon Aug 17 04:55:02 2015    vsa116122 / Space Low (Total=7.87 GB, %Used=73.16 %)    vsa116122 

I am not getting the required result saying age.
I tried like passing below search, but no results.

|inputlookup agingalertreport| eval age=(now() - strptime(alerttime,"%a %b %d %H:%M:%S %Y"))/86400 | fields hostname age

hostname    age
MO-57CCC8504.dc18.saas.sap.corp      
dc15sftpdmz01.sha.sf.priv    
vsa116122    

Why is the age column not getting populated?

0 Karma

splunksurekha
Path Finder

Thanks but still i am not getting the age field loaded.

|inputlookup agingalertreport| eval age=(now() - strptime(alerttime,"%a %b %d %H:%M:%S %Y"))/86400 | fields hostname age

hostname age
MO-57CCC8504

dc15sftpdmz01.sha.sf.priv

vsa116122

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

February 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...