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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...