<?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: How to format a custom time field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510106#M142658</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223269"&gt;@aaroncherian&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" sourcetype="foobar" OR  sourcetype="barfoo"
| rex "Session_ID\": \"(?&amp;lt;Session_ID&amp;gt;\w+)\"" | eval signOnTime=strptime(Sign-on_Time,"%Y-%m-%dT%H:%M:%S-07:00")| eval Sign-on_Time=strftime(signOnTime,"%m-%d-%Y %H:%M:%S")
| stats values(System_Account) as System_Account values(Authentication_Type) as Authentication_Type values(Sign-on_Time) as Sign-on_Time values(Is_Admin) as Is_Admin count(eval(like(Authentication_Type,"Proxy Started"))) as SA_count values(Task) as Task by Session_ID 
| where SA_count &amp;gt; 0 
| where Is_Admin = 1 | table System_Account Authentication_Type Sign-on_Time Session_ID Is_Admin Task

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/DateandTimeFunctions" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/DateandTimeFunctions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2020 19:36:37 GMT</pubDate>
    <dc:creator>anilchaithu</dc:creator>
    <dc:date>2020-07-20T19:36:37Z</dc:date>
    <item>
      <title>How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510098#M142646</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a search running that shows the custom "Sign-on_Time" field in a table. I want to format it to a more readable format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" sourcetype="foobar" OR  sourcetype="barfoo"
| rex "Session_ID\": \"(?&amp;lt;Session_ID&amp;gt;\w+)\""
| stats values(System_Account) as System_Account values(Authentication_Type) as Authentication_Type values(Sign-on_Time) as Sign-on_Time values(Is_Admin) as Is_Admin count(eval(like(Authentication_Type,"Proxy Started"))) as SA_count values(Task) as Task by Session_ID 
| where SA_count &amp;gt; 0 
| where Is_Admin = 1 | table System_Account Authentication_Type Sign-on_Time Session_ID Is_Admin Task&lt;/LI-CODE&gt;&lt;P&gt;The time comes out like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="aaroncherian_0-1595270650463.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9794i1E41E3470ED742D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="aaroncherian_0-1595270650463.png" alt="aaroncherian_0-1595270650463.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there a way for me to format it to like (HH MM SS, MM-DD-YY)?&lt;/P&gt;&lt;P&gt;In my Sign-on_Time field, I tried doing this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval signOnTime=strftime(Sign-on_Time,"%a %B %d %Y %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;and then I tried outputting that in my table and it doesn't show up.&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 19:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510098#M142646</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-20T19:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510106#M142658</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223269"&gt;@aaroncherian&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" sourcetype="foobar" OR  sourcetype="barfoo"
| rex "Session_ID\": \"(?&amp;lt;Session_ID&amp;gt;\w+)\"" | eval signOnTime=strptime(Sign-on_Time,"%Y-%m-%dT%H:%M:%S-07:00")| eval Sign-on_Time=strftime(signOnTime,"%m-%d-%Y %H:%M:%S")
| stats values(System_Account) as System_Account values(Authentication_Type) as Authentication_Type values(Sign-on_Time) as Sign-on_Time values(Is_Admin) as Is_Admin count(eval(like(Authentication_Type,"Proxy Started"))) as SA_count values(Task) as Task by Session_ID 
| where SA_count &amp;gt; 0 
| where Is_Admin = 1 | table System_Account Authentication_Type Sign-on_Time Session_ID Is_Admin Task

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/DateandTimeFunctions" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/DateandTimeFunctions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 19:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510106#M142658</guid>
      <dc:creator>anilchaithu</dc:creator>
      <dc:date>2020-07-20T19:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510107#M142659</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/204579"&gt;@anilchaithu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply, but I tried this, and it keeps saying&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error in 'eval' command: The arguments to the 'strptime' function are invalid. &lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;This was the same error I was getting before as well.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 19:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510107#M142659</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-20T19:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510108#M142660</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223269"&gt;@aaroncherian&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;one more try. Hope this works. fingers crossed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval signOnTime=strptime(Sign-on_Time,"%Y-%m-%dT%H:%M:%S%z")| eval Sign-on_Time=strftime(signOnTime,"%m-%d-%Y %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 19:41:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510108#M142660</guid>
      <dc:creator>anilchaithu</dc:creator>
      <dc:date>2020-07-20T19:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510110#M142662</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/204579"&gt;@anilchaithu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried that, it doesn't work as well &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Something wrong with the formatting. I cant quite figure out what. Your strptime seems correct.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 19:45:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510110#M142662</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-20T19:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510111#M142663</link>
      <description>&lt;P&gt;You have the right idea, but missed a step.&amp;nbsp; The strftime function converts an epoch (integer) into a string.&amp;nbsp; Since the Sign-on_Time field is already a string, strftime returns nothing.&amp;nbsp; The trick is to convert the string into an integer and then convert that into a string.&amp;nbsp; It can be done in a single eval.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval Sign-on_Time=strftime(strptime('Sign-on_Time',"%Y-%m-%dT%H:%M:%S"),"%a %B %d %Y %H:%M:%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 21:04:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510111#M142663</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-20T21:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510112#M142664</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this, and I am getting the same error as when I tried&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/204579"&gt;@anilchaithu&lt;/a&gt;&amp;nbsp;'s solution.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error in 'eval' command: The arguments to the 'strptime' function are invalid&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Jul 2020 19:50:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510112#M142664</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-20T19:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510120#M142668</link>
      <description>Try putting single quotes around the field name as in my updated reply.</description>
      <pubDate>Mon, 20 Jul 2020 21:04:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510120#M142668</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-20T21:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a custom time field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510121#M142669</link>
      <description>&lt;P&gt;Worked Like a charm! Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/204579"&gt;@anilchaithu&lt;/a&gt;&amp;nbsp;for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 21:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-format-a-custom-time-field/m-p/510121#M142669</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-20T21:08:56Z</dc:date>
    </item>
  </channel>
</rss>

