<?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: db connect datetime fields - not timestamp in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/db-connect-datetime-fields-not-timestamp/m-p/108576#M183482</link>
    <description>&lt;P&gt;The reason is because the ctime extraction is being used at index time only for the event time.&lt;/P&gt;

&lt;P&gt;You need to configure Splunk to recognize other time fields as time, because otherwise Spunk just assumes you want the number.&lt;/P&gt;

&lt;P&gt;An example of a search time field extraction for epoch time is:&lt;BR /&gt;
search &lt;SOME search=""&gt; | convert timeformat="%H:%M:%S" ctime(scheduled) AS ScheduledTime |&lt;/SOME&gt;&lt;/P&gt;

&lt;P&gt;I've never actually tried this, but it should work according to the documentation.&lt;BR /&gt;
Documentation/Splunk/5.0.3/SearchReference/Convert&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2013 14:45:12 GMT</pubDate>
    <dc:creator>lukejadamec</dc:creator>
    <dc:date>2013-07-29T14:45:12Z</dc:date>
    <item>
      <title>db connect datetime fields - not timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-datetime-fields-not-timestamp/m-p/108575#M183481</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;

&lt;P&gt;I am using DB Connect to pull in data from a MySQL database table. The tail works and the field i set to be the timestamp works as expected.&lt;/P&gt;

&lt;P&gt;the issue comes from other fields that are set to MySQL DATETIME field type. When these are imported Splunk they are turning up in this format "updated_at=1375083603.000" apposed to "2013-03-07 00:06:00" in the database (DATETIME) field type.&lt;/P&gt;

&lt;P&gt;I am at a loss of what is going on here, I added in the datetime formatting for the output section of the DB connect but think that only works for the timestamp which works ok.&lt;/P&gt;

&lt;P&gt;below is a copy on an event with private data removed, as you can see the scheduled and updated_at fields are DATETIME within MySQL...&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;2013-07-29T08:35:02.000&lt;BR /&gt;
id=5260&lt;BR /&gt;
item=xxxxxxx&lt;BR /&gt;
status=finished&lt;BR /&gt;
metadata=xxxxxxxxx&lt;BR /&gt;
schedule_type=scheduled&lt;BR /&gt;
scheduled=1375086900.000&lt;BR /&gt;
no_reboot=true&lt;BR /&gt;
deleted_on=&lt;BR /&gt;
deleted_status=&lt;BR /&gt;
updated_at=1375083603.000&lt;BR /&gt;
number=xxxx&lt;BR /&gt;
name=xxxxxx&lt;BR /&gt;
label=xxxxxx&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Where would I be going wrong, any tips or guidance would be muchly received.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2013 11:26:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-datetime-fields-not-timestamp/m-p/108575#M183481</guid>
      <dc:creator>jamesmonico</dc:creator>
      <dc:date>2013-07-29T11:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: db connect datetime fields - not timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-datetime-fields-not-timestamp/m-p/108576#M183482</link>
      <description>&lt;P&gt;The reason is because the ctime extraction is being used at index time only for the event time.&lt;/P&gt;

&lt;P&gt;You need to configure Splunk to recognize other time fields as time, because otherwise Spunk just assumes you want the number.&lt;/P&gt;

&lt;P&gt;An example of a search time field extraction for epoch time is:&lt;BR /&gt;
search &lt;SOME search=""&gt; | convert timeformat="%H:%M:%S" ctime(scheduled) AS ScheduledTime |&lt;/SOME&gt;&lt;/P&gt;

&lt;P&gt;I've never actually tried this, but it should work according to the documentation.&lt;BR /&gt;
Documentation/Splunk/5.0.3/SearchReference/Convert&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2013 14:45:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-datetime-fields-not-timestamp/m-p/108576#M183482</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-07-29T14:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: db connect datetime fields - not timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/db-connect-datetime-fields-not-timestamp/m-p/108577#M183483</link>
      <description>&lt;P&gt;Another possibility is to use a database function during your original query to convert the DATETIME data type into a character string format that Splunk will recognize as a time. In Oracle I use the &lt;CODE&gt;"to_char"&lt;/CODE&gt; function something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;select to_char(scheduled,'YYYY-MM-DD HH24:MI:SS') scheduledtime from table;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I'm assuming that MySQL would have something similar.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2013 16:40:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/db-connect-datetime-fields-not-timestamp/m-p/108577#M183483</guid>
      <dc:creator>pmdba</dc:creator>
      <dc:date>2013-07-31T16:40:17Z</dc:date>
    </item>
  </channel>
</rss>

