<?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: UNIX time for the first day of the month of last month in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528735#M149273</link>
    <description>&lt;P&gt;Are you sure? The relative_time syntax and value should work fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try running this run-anywhere search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval today=strftime( _time,"%F %T") | eval firstOfLastMonth=strftime( relative_time(_time,"-1mon@mon") ,"%F %T")&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 09 Nov 2020 20:31:11 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2020-11-09T20:31:11Z</dc:date>
    <item>
      <title>UNIX time for the first day of the month of last month</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528569#M149257</link>
      <description>&lt;P&gt;I am querying Nessus imported data and I would like to find old vulnerabilities still present today.&lt;BR /&gt;More precisely, events where the publication patch date (patchPubDate in UNIX time) is older than the first day of last month.&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp; &amp;nbsp; &amp;nbsp;today is 9/11/2020 , so I would like to get the events older than 1/10/2020&lt;/P&gt;&lt;P&gt;I tried the query below but it gives 0 results which it is not possible because, unfortunately, I know I have dozens. So the query must be wrong somehow.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;note: last_found is when the vulnerability was seen for last time in UNIX time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=nessus sourcetype="tenable:sc:vuln" patchPubDate!=-1
| eval today = round(relative_time(now(), "-0d@d"))
| eval month = strftime(patchPubDate,"%m")
| eval lastmonth = month - 1
| eval year = strftime(patchPubDate,"%Y")
| eval dateLastMonth = "1/".lastmonth."/".year
| eval dateLastMonthUnix = strptime(dateLastMonth, "%d/%m/%Y")
| where last_found &amp;gt;= today AND pathPubDate&amp;lt;dateLastMonthUnix&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any suggestion?&lt;/P&gt;&lt;P&gt;many thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 17:35:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528569#M149257</guid>
      <dc:creator>jacortijo</dc:creator>
      <dc:date>2020-11-09T17:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX time for the first day of the month of last month</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528572#M149259</link>
      <description>&lt;P&gt;There is a simpler way to get the first day of last month.&amp;nbsp; Use relative_time().&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=nessus sourcetype="tenable:sc:vuln" patchPubDate!=-1
| eval today = relative_time(now(), "-0d@d")
| eval dateLastMonthUnix=relative_time(now(), "-1mon@mon")
| where last_found &amp;gt;= today AND pathPubDate&amp;lt;dateLastMonthUnix&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 17:45:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528572#M149259</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-09T17:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX time for the first day of the month of last month</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528734#M149272</link>
      <description>&lt;P&gt;I dont think that&amp;nbsp;&lt;SPAN&gt;relative_time command&lt;/SPAN&gt; is giving the date I need.&lt;/P&gt;&lt;P&gt;if today is 9/11, you relative_time command gives 9/10 and I want to get 1/10.&lt;/P&gt;&lt;PRE&gt;eval dateLastMonthUnix=relative_time(now(), "-1mon@mon")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 20:17:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528734#M149272</guid>
      <dc:creator>jacortijo</dc:creator>
      <dc:date>2020-11-09T20:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX time for the first day of the month of last month</title>
      <link>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528735#M149273</link>
      <description>&lt;P&gt;Are you sure? The relative_time syntax and value should work fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try running this run-anywhere search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval today=strftime( _time,"%F %T") | eval firstOfLastMonth=strftime( relative_time(_time,"-1mon@mon") ,"%F %T")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 20:31:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/UNIX-time-for-the-first-day-of-the-month-of-last-month/m-p/528735#M149273</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-11-09T20:31:11Z</dc:date>
    </item>
  </channel>
</rss>

