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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...