<?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 do I change timestamp field with a different time format? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326446#M60687</link>
    <description>&lt;P&gt;Your field &lt;CODE&gt;created&lt;/CODE&gt; is in string format so your conversion fails using strftime function (which takes an epoch timestamp and converts it to string). Also, the field name is has wrong case in the &lt;CODE&gt;fieldformat&lt;/CODE&gt; command (field names are case-sensitive). Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ansible_tower" | table created job failed | sort created + desc | dedup job | eval create=strftime(strptime(created,"%Y-%m-%dT%H:%M:%S.%3N%Z"),"%d-%m-%y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For your chart, you can do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="ansible_tower" | table created job failed | sort created + desc | dedup job | eval _time=strptime(created,"%Y-%m-%dT%H:%M:%S.%3N%Z") | timechart span=1d count by failed | rename False as Succeed True as Failed
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Apr 2018 19:49:23 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-04-10T19:49:23Z</dc:date>
    <item>
      <title>How do I change timestamp field with a different time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326445#M60686</link>
      <description>&lt;P&gt;I am trying to write a search query to change time format here and make it to simple MM-DD-YY , can anyone help me writing a query? I tried with convert function and other functions but may be i am missing something in my query. Kindly see attached image. Also, once I convert it then I want to sum up number of jobs failed(Flase/True) and then want to show X-axis as time and Y-axis as number of jobs succeed/failed kind of analytics with charts. Is it possible to do with search query?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 19:20:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326445#M60686</guid>
      <dc:creator>purvak2525</dc:creator>
      <dc:date>2018-04-10T19:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change timestamp field with a different time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326446#M60687</link>
      <description>&lt;P&gt;Your field &lt;CODE&gt;created&lt;/CODE&gt; is in string format so your conversion fails using strftime function (which takes an epoch timestamp and converts it to string). Also, the field name is has wrong case in the &lt;CODE&gt;fieldformat&lt;/CODE&gt; command (field names are case-sensitive). Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ansible_tower" | table created job failed | sort created + desc | dedup job | eval create=strftime(strptime(created,"%Y-%m-%dT%H:%M:%S.%3N%Z"),"%d-%m-%y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For your chart, you can do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="ansible_tower" | table created job failed | sort created + desc | dedup job | eval _time=strptime(created,"%Y-%m-%dT%H:%M:%S.%3N%Z") | timechart span=1d count by failed | rename False as Succeed True as Failed
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Apr 2018 19:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326446#M60687</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-10T19:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change timestamp field with a different time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326447#M60688</link>
      <description>&lt;P&gt;Thanks. I did make changes and worked for me. &lt;/P&gt;

&lt;P&gt;I have data of index="ansible_tower" of last two months, in terms of extracting those all data with timechart as mentioned in your search query, how do I change the span for this for two months? I believe with span=1d only collects data of a week per the result i am seeing of below query. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="ansible_tower" | table created job failed | sort created + desc | dedup job | eval _time=strptime(created,"%Y-%m-%dT%H:%M:%S.%3N%Z") | timechart span=1d count by failed | rename False as Succeed True as Failed&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:46:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326447#M60688</guid>
      <dc:creator>purvak2525</dc:creator>
      <dc:date>2018-04-11T17:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change timestamp field with a different time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326448#M60689</link>
      <description>&lt;P&gt;The span=1d means, the count is calculated for one day period in the selected time range. If your time range is 1 week, you'd see 7 rows in the result, one for each day of that week. If your time range is 1 month, you'd see one row for each day of that month. So, if you select time range as 2 months, you'd see as many entries as the number of days in those 2 months. You can change the span to 1w (one week) or any other suitable value per your need. See this for all span options: &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/Timechart#Span_options"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/Timechart#Span_options&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:56:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326448#M60689</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-04-11T17:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change timestamp field with a different time format?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326449#M60690</link>
      <description>&lt;P&gt;Thank you. I updated the query per your inputs. &lt;/P&gt;

&lt;P&gt;Here is the search query which is giving me data about number of jobs run failed/succeed per day with every minute update on daily basis.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="ansible_tower" | table created job failed | sort created + desc | dedup job | eval _time=strptime(created,"%Y-%m-%dT%H:%M:%S.%3N%Z") | timechart span=1d count by failed | rename false as Succeed true as Failed&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 19:15:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-change-timestamp-field-with-a-different-time-format/m-p/326449#M60690</guid>
      <dc:creator>purvak2525</dc:creator>
      <dc:date>2018-04-26T19:15:05Z</dc:date>
    </item>
  </channel>
</rss>

