<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Alert using calendar arithmetic in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-using-calendar-arithmetic/m-p/486876#M8623</link>
    <description>&lt;P&gt;Timestamp math is easy.  The trick is to convert the timestamp into integer (epoch) form first.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval epoch=strptime(accountPassword, "%Y-%m-%dT%H:%M:%S.%5N%Z")
| eval alertEpoch=epoch + (86400 * 520)
| eval alertTime = strftime(alertEpoch, "%Y-%m-%dT%H:%M:%S.%5N%Z")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Nov 2019 16:32:45 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-11-19T16:32:45Z</dc:date>
    <item>
      <title>Alert using calendar arithmetic</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-using-calendar-arithmetic/m-p/486874#M8621</link>
      <description>&lt;P&gt;Hi. We a Dashboard that informs us of the date a service account password was changed/reset. Passwords need to be reset no later than every 700 days, but we'd like Splunk to alert us 6 months prior to that deadline. &lt;/P&gt;

&lt;P&gt;Our date field looks like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  2019-11-15T15:27:42.416732Z
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From that date, we need to alert when that account password is 520 days old (700 days minus 6 months/180 days). So in the above example, we need to receive an alert on April 18, 2021, to remind us to schedule a password reset for that account. &lt;/P&gt;

&lt;P&gt;We are getting the account name date of the last password set from Active Directory, in case that matters. &lt;/P&gt;

&lt;P&gt;In other words, is there a way to do "Calendar arithmetic" in Splunk? I have no idea where to even begin with this. &lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 15:56:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-using-calendar-arithmetic/m-p/486874#M8621</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2019-11-19T15:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Alert using calendar arithmetic</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-using-calendar-arithmetic/m-p/486875#M8622</link>
      <description>&lt;P&gt;I can actually calculate the epoch time six months in the future from the date of the password set:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | eval pwDate=strptime(pwdLastSet,"%Y-%m-%dT%H:%M:%S.%3N") | eval sixMonthsAhead=relative_time(pwDate, "+520d@d") | table cn, pwdLastSet, sixMonthsAhead
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I can't seem to get an alert to trigger once that date arrives...&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 16:32:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-using-calendar-arithmetic/m-p/486875#M8622</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2019-11-19T16:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Alert using calendar arithmetic</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-using-calendar-arithmetic/m-p/486876#M8623</link>
      <description>&lt;P&gt;Timestamp math is easy.  The trick is to convert the timestamp into integer (epoch) form first.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval epoch=strptime(accountPassword, "%Y-%m-%dT%H:%M:%S.%5N%Z")
| eval alertEpoch=epoch + (86400 * 520)
| eval alertTime = strftime(alertEpoch, "%Y-%m-%dT%H:%M:%S.%5N%Z")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Nov 2019 16:32:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-using-calendar-arithmetic/m-p/486876#M8623</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-11-19T16:32:45Z</dc:date>
    </item>
  </channel>
</rss>

