Alerting

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

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

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, an upvote would be appreciated.

View solution in original post

0 Karma

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, an upvote would be appreciated.

View solution in original post

0 Karma

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

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