<?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: Compare a field date with current date for alert in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453042#M11597</link>
    <description>&lt;P&gt;The date and time changes daily, the names also change over long periods of time.&lt;/P&gt;

&lt;P&gt;The "-1d@d" doesn't seem to only display the results from the last day.&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2019 17:50:14 GMT</pubDate>
    <dc:creator>glen_drivas</dc:creator>
    <dc:date>2019-05-13T17:50:14Z</dc:date>
    <item>
      <title>Compare a field date with current date for alert</title>
      <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453039#M11594</link>
      <description>&lt;P&gt;I have a simple windows script that collects CRL expiration dates and runs as a task every 24 hours&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;echo | set /P = "%date:~4,10% %time:~1,7% " &amp;gt;&amp;gt; c:\crl_expiration.log&lt;BR /&gt;
echo | set /P = "crl1.crl " &amp;gt;&amp;gt; c:\crl_expiration.log&lt;BR /&gt;
openssl crl -inform DER -in \\x.x.x.x\crl\crl1.crl -noout -nextupdate &amp;gt;&amp;gt; c:\crl_expiration.log&lt;BR /&gt;
echo.&amp;gt;&amp;gt;c:\crl_expiration.log&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The log output looks like this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;05/09/2019 13:00:01 crl1.crl nextUpdate=May 15 17:00:00 2019 GMT&lt;BR /&gt;
05/09/2019 13:00:02 crl2.crl nextUpdate=May 15 17:00:00 2019 GMT&lt;BR /&gt;
05/09/2019 13:00:05 crl3.crl nextUpdate=May 15 17:00:00 2019 GMT&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;These get indexed by Splunk&lt;/P&gt;

&lt;P&gt;I need to compare the given  CRL expiration date listed as nextUpdate to today and I need to create an alert if the CRL's are going to expire soon. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eval dateadded_epoch = strptime('Date Added', "%b %d %H:%M:%S %Y") | where dateadded_epoch &amp;gt;= relative_time(now(), "-1d@d")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I have not been able to get this to work for some reason and if someone has a suggestion on a better way to do this, it would be welcome.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 18:17:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453039#M11594</guid>
      <dc:creator>glen_drivas</dc:creator>
      <dc:date>2019-05-10T18:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a field date with current date for alert</title>
      <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453040#M11595</link>
      <description>&lt;P&gt;Has the field been extracted correctly? Your raw data doesn't show any field name 'Date Added', just multiple entries for nextUpdate (only first one will be extracted by default).&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 19:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453040#M11595</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-05-10T19:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a field date with current date for alert</title>
      <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453041#M11596</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="05/09/2019 13:00:01 crl1.crl nextUpdate=May 15 17:00:00 2019 GMT 05/09/2019 13:00:02 crl2.crl nextUpdate=May 15 17:00:00 2019 GMT 05/09/2019 13:00:05 crl3.crl nextUpdate=May 15 17:00:00 2019 GMT" 
| rex max_match=0 "nextUpdate=(?&amp;lt;expiration&amp;gt;\S+\s\S+\s\S+\s\S+)"
| mvexpand expiration
| where strptime(expiration, "%b %d %H:%M:%S %Y") &amp;gt;= relative_time(now(), "-1d@d")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 May 2019 05:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453041#M11596</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-11T05:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a field date with current date for alert</title>
      <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453042#M11597</link>
      <description>&lt;P&gt;The date and time changes daily, the names also change over long periods of time.&lt;/P&gt;

&lt;P&gt;The "-1d@d" doesn't seem to only display the results from the last day.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 17:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453042#M11597</guid>
      <dc:creator>glen_drivas</dc:creator>
      <dc:date>2019-05-13T17:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a field date with current date for alert</title>
      <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453043#M11598</link>
      <description>&lt;P&gt;You asked to compare the date to the current date.  That is what the &lt;CODE&gt;-1d@d&lt;/CODE&gt; does.  I don't know what you mean; I only know what you write.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 22:29:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453043#M11598</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-13T22:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a field date with current date for alert</title>
      <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453044#M11599</link>
      <description>&lt;P&gt;To attempt to get this working for real, I tried this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=crl | rex max_match=0 "nextUpdate=(?&amp;lt;expiration&amp;gt;\S+\s\S+\s\S+\s\S+)" |rex max_match=0 (?&amp;lt;crl_name&amp;gt;crl\S+.crl) | mvexpand expiration
 | where strptime(expiration, "%b %d %H:%M:%S %Y") &amp;gt;= relative_time(now(), "-1d@d") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's showing all results, the "-1d@d" isn't limiting the results by dates specified.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 22:52:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453044#M11599</guid>
      <dc:creator>glen_drivas</dc:creator>
      <dc:date>2019-05-13T22:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a field date with current date for alert</title>
      <link>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453045#M11600</link>
      <description>&lt;P&gt;If that is so, it is definitely because all of the events have at least 1 value for &lt;CODE&gt;expiration&lt;/CODE&gt; that is from &lt;CODE&gt;today&lt;/CODE&gt;, which is what you asked for.  It sounds like the data is not really how you expect it to be.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 23:19:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Compare-a-field-date-with-current-date-for-alert/m-p/453045#M11600</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-13T23:19:25Z</dc:date>
    </item>
  </channel>
</rss>

