<?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 custom datetime.xml is not working for me in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128176#M26311</link>
    <description>&lt;P&gt;hi guys&lt;/P&gt;

&lt;P&gt;I have 2 different kind of events inside the same file. I am aware that I need to use a custom datetime.xml in order to recognize the timestamp of each sort of event. However it is not working for me. &lt;/P&gt;

&lt;P&gt;These are the two kinds of events and I highlight in bold what should be recognized as the timestamp:&lt;/P&gt;

&lt;P&gt;1081|2|&lt;STRONG&gt;20150512&lt;/STRONG&gt;|436959|1660|0.00|1.00|0.00|4.5000|0|20&lt;/P&gt;

&lt;P&gt;1081|2|436968|20150512|&lt;STRONG&gt;20150512|1336&lt;/STRONG&gt;|1|1|000|0.00|0.00|3.20|5959|0034|G|0|20&lt;/P&gt;

&lt;P&gt;This is what I coded in my new datetime.xml&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;datetime&amp;gt;

&amp;lt;define name="_mc1" extract="year, month, day"&amp;gt;
    &amp;amp;lt;![CDATA[^[^\|]*(\|[^\|]*)\|(\d\d\d\d)(\d\d)(\d\d)(\|[^\|]*){8}$]]&amp;amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;define name="_mc2" extract="year, month, day, hour, minute"&amp;gt;
    &amp;amp;lt;![CDATA[^[^\|]*(\|[^\|]*){3}\|(\d\d\d\d)(\d\d)(\d\d)\|(\d\d)(\d\d)(\|[^\|]*){11}$]]&amp;amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;timePatterns&amp;gt;
     &amp;lt;use name="_mc2"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;
&amp;lt;datePatterns&amp;gt;
     &amp;lt;use name="_mc1"/&amp;gt;
     &amp;lt;use name="_mc2"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;
&amp;lt;/datetime&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in my props.conf this is what I have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test]
SHOULD_LINEMERGE = false
MAX_EVENTS = 1
DATETIME_CONFIG = /etc/apps/testing/local/datetime.xml
TZ = Europe/Madrid
MAX_TIMESTAMP_LOOKAHEAD=100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any ideas why my code is not working??&lt;/P&gt;</description>
    <pubDate>Wed, 27 May 2015 08:29:44 GMT</pubDate>
    <dc:creator>asimagu</dc:creator>
    <dc:date>2015-05-27T08:29:44Z</dc:date>
    <item>
      <title>custom datetime.xml is not working for me</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128176#M26311</link>
      <description>&lt;P&gt;hi guys&lt;/P&gt;

&lt;P&gt;I have 2 different kind of events inside the same file. I am aware that I need to use a custom datetime.xml in order to recognize the timestamp of each sort of event. However it is not working for me. &lt;/P&gt;

&lt;P&gt;These are the two kinds of events and I highlight in bold what should be recognized as the timestamp:&lt;/P&gt;

&lt;P&gt;1081|2|&lt;STRONG&gt;20150512&lt;/STRONG&gt;|436959|1660|0.00|1.00|0.00|4.5000|0|20&lt;/P&gt;

&lt;P&gt;1081|2|436968|20150512|&lt;STRONG&gt;20150512|1336&lt;/STRONG&gt;|1|1|000|0.00|0.00|3.20|5959|0034|G|0|20&lt;/P&gt;

&lt;P&gt;This is what I coded in my new datetime.xml&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;datetime&amp;gt;

&amp;lt;define name="_mc1" extract="year, month, day"&amp;gt;
    &amp;amp;lt;![CDATA[^[^\|]*(\|[^\|]*)\|(\d\d\d\d)(\d\d)(\d\d)(\|[^\|]*){8}$]]&amp;amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;define name="_mc2" extract="year, month, day, hour, minute"&amp;gt;
    &amp;amp;lt;![CDATA[^[^\|]*(\|[^\|]*){3}\|(\d\d\d\d)(\d\d)(\d\d)\|(\d\d)(\d\d)(\|[^\|]*){11}$]]&amp;amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;timePatterns&amp;gt;
     &amp;lt;use name="_mc2"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;
&amp;lt;datePatterns&amp;gt;
     &amp;lt;use name="_mc1"/&amp;gt;
     &amp;lt;use name="_mc2"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;
&amp;lt;/datetime&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in my props.conf this is what I have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[test]
SHOULD_LINEMERGE = false
MAX_EVENTS = 1
DATETIME_CONFIG = /etc/apps/testing/local/datetime.xml
TZ = Europe/Madrid
MAX_TIMESTAMP_LOOKAHEAD=100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any ideas why my code is not working??&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 08:29:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128176#M26311</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2015-05-27T08:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: custom datetime.xml is not working for me</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128177#M26312</link>
      <description>&lt;P&gt;The path &lt;CODE&gt;/etc/apps/testing/local/datetime.xml&lt;/CODE&gt; looks like an absolute path from the filesystem root. Does changing it to &lt;CODE&gt;etc/apps/testing/local/datetime.xml&lt;/CODE&gt; help?&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 10:57:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128177#M26312</guid>
      <dc:creator>laserval</dc:creator>
      <dc:date>2015-05-27T10:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: custom datetime.xml is not working for me</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128178#M26313</link>
      <description>&lt;P&gt;no, same thing. The location is not the problem&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2015 08:21:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128178#M26313</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2015-05-28T08:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: custom datetime.xml is not working for me</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128179#M26314</link>
      <description>&lt;P&gt;So, I happened to find the solution and the source of the problem:&lt;/P&gt;

&lt;P&gt;When doing the regex, every parenthesis is a capture group that will go into each of the timestamp variables.&lt;/P&gt;

&lt;P&gt;I tried using ?:  at the groups that I did not need to remember/capture and voila!! it works!!&lt;/P&gt;

&lt;P&gt;This is it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;datetime&amp;gt;

&amp;lt;define name="_mc1" extract="year, month, day"&amp;gt;
    &amp;lt;text&amp;gt;&amp;lt;![CDATA[^[^\|]*(?:\|[^\|]*)\|(\d\d\d\d)(\d\d)(\d\d)(?:\|[^\|]*){8}$]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;define name="_mc2" extract="year, month, day, hour, minute"&amp;gt;
    &amp;lt;text&amp;gt;&amp;lt;![CDATA[^[^\|]*(?:\|[^\|]*){3}\|(\d\d\d\d)(\d\d)(\d\d)\|(\d\d)(\d\d)(?:\|[^\|]*){11}$]]&amp;gt;&amp;lt;/text&amp;gt;
&amp;lt;/define&amp;gt;
&amp;lt;timePatterns&amp;gt;
     &amp;lt;use name="_mc2"/&amp;gt;
&amp;lt;/timePatterns&amp;gt;
&amp;lt;datePatterns&amp;gt;
     &amp;lt;use name="_mc1"/&amp;gt;
     &amp;lt;use name="_mc2"/&amp;gt;
&amp;lt;/datePatterns&amp;gt;
&amp;lt;/datetime&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2015 08:24:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/custom-datetime-xml-is-not-working-for-me/m-p/128179#M26314</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2015-05-28T08:24:28Z</dc:date>
    </item>
  </channel>
</rss>

