<?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: Help on SystemTime format and SystemTime stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455862#M172262</link>
    <description>&lt;P&gt;I dont know why but i cant accept your answer&lt;/P&gt;</description>
    <pubDate>Thu, 28 Mar 2019 06:56:51 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2019-03-28T06:56:51Z</dc:date>
    <item>
      <title>Help on SystemTime format and SystemTime stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455857#M172257</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I use the search below but SystemTime doesnt return results&lt;BR /&gt;
SystemTime format is like this : '2019-03-25T03:49:42.458421900Z'&lt;BR /&gt;
What is the issue please?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="x" sourcetype=x (EventCode=6005 OR EventCode=6006) 
| eval SystemTime=strftime(strptime(SystemTime, "%Y-%m-%dT%H:%M:%S.%9Q%Z"), "%y-%m-%d %H:%M") 
| table host SystemTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also want to stats in a table the latest SystemTime for EventCode=6005 and the latest SystemTime for EventCode=6006)&lt;BR /&gt;
Something like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats latest(6005) as LastLogon, latest(6006) as LastReboot by host 
| sort -LastLogon -LastReboot
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could you help me please??&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 13:27:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455857#M172257</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-03-25T13:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SystemTime format and SystemTime stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455858#M172258</link>
      <description>&lt;P&gt;When you run below query, does the value shown in the table has single quotes in them?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="x" sourcetype=x (EventCode=6005 OR EventCode=6006) 
 | table host SystemTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For your second requirement, try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="x" sourcetype=x (EventCode=6005 OR EventCode=6006) 
| stats latest(SystemTime) as SystemTime by host EventCode
| xyseries host EventCode SystemTime | rename "6005" as LastLogon "6006" as LastReboot
| sort -LastLogon -LastReboot
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update - working solution for time conversion&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="x" sourcetype=x (EventCode=6005 OR EventCode=6006) 
  | eval SystemTime=strftime(strptime(SystemTime, "'%Y-%m-%dT%H:%M:%S.%9Q%Z'"), "%y-%m-%d %H:%M") 
  | table host SystemTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Mar 2019 14:10:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455858#M172258</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-03-25T14:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SystemTime format and SystemTime stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455859#M172259</link>
      <description>&lt;P&gt;yes there is single quote&lt;BR /&gt;
I have changed it in my eval but it doesnt works....&lt;BR /&gt;
Thanks for the second requirement its good&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 11:29:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455859#M172259</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-03-27T11:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SystemTime format and SystemTime stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455860#M172260</link>
      <description>&lt;P&gt;Give this a try (single quotes are added to strptime function time format)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="x" sourcetype=x (EventCode=6005 OR EventCode=6006) 
 | eval SystemTime=strftime(strptime(SystemTime, "'%Y-%m-%dT%H:%M:%S.%9Q%Z'"), "%y-%m-%d %H:%M") 
 | table host SystemTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Mar 2019 16:22:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455860#M172260</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-03-27T16:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SystemTime format and SystemTime stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455861#M172261</link>
      <description>&lt;P&gt;perfect it works!! thanks&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 05:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455861#M172261</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-03-28T05:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SystemTime format and SystemTime stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455862#M172262</link>
      <description>&lt;P&gt;I dont know why but i cant accept your answer&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 06:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455862#M172262</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2019-03-28T06:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help on SystemTime format and SystemTime stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455863#M172263</link>
      <description>&lt;P&gt;I converted my comments to answer now. You should be able to close it now.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 14:27:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-SystemTime-format-and-SystemTime-stats/m-p/455863#M172263</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-03-28T14:27:44Z</dc:date>
    </item>
  </channel>
</rss>

