<?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 Join a year and month to create a date in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456467#M99441</link>
    <description>&lt;P&gt;Good morning!&lt;/P&gt;

&lt;P&gt;I have a field for a year and a field for a month. Can I join these two together to create a date that I can then make a timechart based off of. I have a lot of machines I'm tracking an OS version for and want to display a chart mapping machines to dates. We have a custom format of operating system being '201804.1' for example and I've extracted 2018 as a year and 04 as a month and want to create a a visual based off of that. &lt;/P&gt;

&lt;P&gt;I appreciate any help!&lt;/P&gt;</description>
    <pubDate>Mon, 19 Aug 2019 12:34:40 GMT</pubDate>
    <dc:creator>jkordis</dc:creator>
    <dc:date>2019-08-19T12:34:40Z</dc:date>
    <item>
      <title>Join a year and month to create a date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456467#M99441</link>
      <description>&lt;P&gt;Good morning!&lt;/P&gt;

&lt;P&gt;I have a field for a year and a field for a month. Can I join these two together to create a date that I can then make a timechart based off of. I have a lot of machines I'm tracking an OS version for and want to display a chart mapping machines to dates. We have a custom format of operating system being '201804.1' for example and I've extracted 2018 as a year and 04 as a month and want to create a a visual based off of that. &lt;/P&gt;

&lt;P&gt;I appreciate any help!&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 12:34:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456467#M99441</guid>
      <dc:creator>jkordis</dc:creator>
      <dc:date>2019-08-19T12:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Join a year and month to create a date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456468#M99442</link>
      <description>&lt;P&gt;Yes, its possible.&lt;/P&gt;

&lt;P&gt;All you need to do it create a new field that the combination of your year and month field.&lt;BR /&gt;
Syntax - eval date_combine = year."-".month ( "-" is used as a delimiter.)&lt;BR /&gt;
You can then use the new field in your chart.&lt;/P&gt;

&lt;P&gt;Below is an example with the internal index&lt;BR /&gt;
index=_internal | eval date_combine= date_hour."-".date_year | timechart count by date_combine&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456468#M99442</guid>
      <dc:creator>chinmoya</dc:creator>
      <dc:date>2020-09-30T01:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Join a year and month to create a date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456469#M99443</link>
      <description>&lt;P&gt;Hi @jkordis,&lt;/P&gt;

&lt;P&gt;You can use the &lt;CODE&gt;strptime&lt;/CODE&gt; command : &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/DateandTimeFunctions#strptime"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/DateandTimeFunctions#strptime&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval n=strptime(yearField."-".monthField, "%Y-%m")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or you can use &lt;CODE&gt;strftime&lt;/CODE&gt; command right away without any extractions on 201804.1.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 12:58:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456469#M99443</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-08-19T12:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Join a year and month to create a date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456470#M99444</link>
      <description>&lt;P&gt;Yes, it is very easy but you also need to convert to &lt;CODE&gt;time_t&lt;/CODE&gt; (AKA &lt;CODE&gt;epoch&lt;/CODE&gt;) integer so it would look like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval _time = &amp;lt;YourYearFieldHere&amp;gt; . "/" . &amp;lt;YourMonthFieldHere&amp;gt;
| eval _time strptime(_time, "%Y/%m")
| timechart ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2019 16:47:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Join-a-year-and-month-to-create-a-date/m-p/456470#M99444</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-19T16:47:27Z</dc:date>
    </item>
  </channel>
</rss>

