<?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: appending 2 searches + date format is lost  YYYY-MM becomes YYYY in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292073#M88224</link>
    <description>&lt;P&gt;Or use the fieldformat command ( &lt;CODE&gt;| fieldformat_time=strftime(_time,"%Y-%m")&lt;/CODE&gt; ).&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2017 17:29:24 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-02-09T17:29:24Z</dc:date>
    <item>
      <title>appending 2 searches + date format is lost  YYYY-MM becomes YYYY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292070#M88221</link>
      <description>&lt;P&gt;I have 2 searches: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;search1&lt;/CODE&gt; and &lt;CODE&gt;search2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;search 1 gives :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   kpi1    kpi2    kpi3 kpi4
2016-01 493.26  636.06  56.322  1129.32
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search 2 gives :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time   kpi1    kpi2    kpi3 kpi4
2017-01 193.26  44.06   34.322  239.32
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I combine them with the &lt;CODE&gt;append&lt;/CODE&gt; (e.g. &lt;CODE&gt;search 1 ... | append [ search2 ...]&lt;/CODE&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; _time    kpi1    kpi2    kpi3 kpi4
2016    470.55  277.07  37.060  747.62
2017    193.26  44.06   34.322  239.32
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but not the time format loses the month (e.g 2017-01 becomes 2017)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;How do I get it to hold on to the month?&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; _time    kpi1    kpi2    kpi3 kpi4
2016-01 470.55  277.07  37.060  747.62
2017-01 193.26  44.06   34.322  239.32
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Feb 2017 01:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292070#M88221</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2017-02-09T01:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: appending 2 searches + date format is lost  YYYY-MM becomes YYYY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292071#M88222</link>
      <description>&lt;P&gt;can you try to put _time into epoch on both searches and then change the format to YYYY-MM after the append to see if that works?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 02:06:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292071#M88222</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-02-09T02:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: appending 2 searches + date format is lost  YYYY-MM becomes YYYY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292072#M88223</link>
      <description>&lt;P&gt;If you left _time in its original, epoch format in both searches, and each search is returning only a single record, then the interface may just be guessing that you only care about the year.  Tell it what you want.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval _time=strftime(_time,"%Y-%m")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;See somesoni2's answer below, which leaves the underlying field in epoch format and probably should be the general way you do this stuff.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 17:21:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292072#M88223</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-09T17:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: appending 2 searches + date format is lost  YYYY-MM becomes YYYY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292073#M88224</link>
      <description>&lt;P&gt;Or use the fieldformat command ( &lt;CODE&gt;| fieldformat_time=strftime(_time,"%Y-%m")&lt;/CODE&gt; ).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 17:29:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292073#M88224</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-02-09T17:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: appending 2 searches + date format is lost  YYYY-MM becomes YYYY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292074#M88225</link>
      <description>&lt;P&gt;tks @DalJeanis, that worked.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:11:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292074#M88225</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2017-02-09T21:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: appending 2 searches + date format is lost  YYYY-MM becomes YYYY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292075#M88226</link>
      <description>&lt;P&gt;Awesome!  Good to hear.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 23:26:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appending-2-searches-date-format-is-lost-YYYY-MM-becomes-YYYY/m-p/292075#M88226</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-09T23:26:57Z</dc:date>
    </item>
  </channel>
</rss>

