<?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 MS SQL Datetime in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166430#M186131</link>
    <description>&lt;P&gt;Did you set the props.conf in your app updated in your post? that is really required. Even after that it doesn't work i have to officially tell sorry and wait for some Splunk person to assist you.&lt;/P&gt;</description>
    <pubDate>Fri, 16 May 2014 19:38:56 GMT</pubDate>
    <dc:creator>linu1988</dc:creator>
    <dc:date>2014-05-16T19:38:56Z</dc:date>
    <item>
      <title>DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166415#M186116</link>
      <description>&lt;P&gt;Splunk not reading my datetime value correctly:&lt;/P&gt;

&lt;P&gt;select top 1 convert(datetime,posting_date) as PostedDate&lt;/P&gt;

&lt;P&gt;Result:&lt;BR /&gt;
PostedDate: 2005-12-08 08:26:00.000&lt;/P&gt;

&lt;P&gt;Following the steps in the documentation this should be all I need to do, but it's not working. Instead Splunk is indexing the event based on the date / time of the Splunk server. &lt;/P&gt;

&lt;P&gt;I also tried following the workaround suggested in the documentation:&lt;BR /&gt;
output.timestamp.parse.format = yyyy-mm-dd hh:MM:ss.SSS&lt;/P&gt;

&lt;P&gt;and it still doesn't work, just not sure what I'm missing. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Updated inputs.conf&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dbmon-tail://RO_DB/PostedOrders]
host = DBSRVR
index = DBIndex
interval = 2m
output.format = kv
output.timestamp = 1
output.timestamp.column = por_POSTING_DATE
query = SELECT por_POSTING_DATE,por_ORD_KEY,por_POSTING_DATE as PostedDate from table {{WHERE $rising_column$ &amp;gt; ?}}
sourcetype = PostedOrders
tail.rising.column = por_ORD_KEY
table = PostedOrders
disabled = 0
output.timestamp.format = yyyy-mm-dd hh:MM:ss
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;EM&gt;Updated Props.conf&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[PostedOrders]
MAX_DAYS_AGO = 5000
TIME_FORMAT=%s
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 May 2014 17:00:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166415#M186116</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-15T17:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166416#M186117</link>
      <description>&lt;P&gt;Hello Devicenul,&lt;BR /&gt;
There is no need of having the convert function. Is the field in datetime format in DB? If yes DB Connect will automatically recognize that and assign it to your events.&lt;/P&gt;

&lt;P&gt;Sample configuration which works for me.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Updated Config:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;inputs.conf &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dbmon-tail://test/taily]
index = main
interval = 30
output.format = csv
output.timestamp = 0
output.timestamp.column = posting_date
output.timestamp.format = %d/%m/%Y %H:%M:%S
query = select top 1 posting_date,posting_date as PostedDate {{WHERE $rising_column$ &amp;gt; ?}}
sourcetype = dummy
table = dummy
tail.rising.column = posting_date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dummy]
MAX_DAYS_AGO = 5000
TIME_FORMAT=%s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Splunk will consume the posting_date field to get the eventtime.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Note: if any rising column value has already been recorded then go to &lt;BR /&gt;
&lt;CODE&gt;Splunk\var\lib\splunk\persistentstorage\dbx\&lt;/CODE&gt;&lt;STRONG&gt;&lt;EM&gt;d6db0e2901cbef084bc0f4c01134d4f6&lt;/EM&gt;&lt;/STRONG&gt; kind of dir&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 17:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166416#M186117</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-15T17:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166417#M186118</link>
      <description>&lt;P&gt;the posting_date column is in the smalldatetime format without the convert() the data returns a bit differently(result: 2008-05-09 10:30:00)  so should my inputs.conf look like this:&lt;/P&gt;

&lt;P&gt;output.timestamp=1&lt;BR /&gt;
output.timestamp.column = PostedDate&lt;BR /&gt;
output.timestamp.format = yyyy-mm-dd hh:MM:ss&lt;BR /&gt;
query= select top 10 posting_date as PostedDate from table&lt;/P&gt;

&lt;P&gt;Is the timestamp.format of dd/mm/yyy hh:MM:ss in your config because splunk wants it that way? I see you also have an output.timestamp of =0 so is the .format line even necessary?&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 18:45:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166417#M186118</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-15T18:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166418#M186119</link>
      <description>&lt;P&gt;no it is not necessary as you rightly said , output.timestamp = 1 then you need the format else all the config is fine and the output.timestamp doesn't affect the input. Just try dump your data into some default index to see if it works.&lt;/P&gt;

&lt;P&gt;More than that just check in dbx.log what exactly is happening... Please come back if you see any issue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 19:06:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166418#M186119</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-15T19:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166419#M186120</link>
      <description>&lt;P&gt;It's still not indexing the correct datetime, keeps saying everything was today (but it is using the correct time). I noticed you said to "dump your data into some default index" ... so I changed the index to the default Splunk index (before I had created an index for this data) and I'm still experiencing the problem, I'm also not using DB-Mon Dump, I'm using DB-Mon Tail but the same rules for datetime field should still apply correct?&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 19:14:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166419#M186120</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-15T19:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166420#M186121</link>
      <description>&lt;P&gt;if you are getting the data and the time.format.parse doesn't work try setting the source in a props.conf file for time recognition.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 19:39:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166420#M186121</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-15T19:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166421#M186122</link>
      <description>&lt;P&gt;forgot to mention one simple thingy&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;select top 1 convert(datetime,posting_date) as PostedDate {{ ... $rising_column$ &amp;gt; ?}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for dbtail. I have just done with some tests with you kind of sample data splunk recognized everything perfectly. Using DB connect 1.1.3&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 19:56:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166421#M186122</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-15T19:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166422#M186123</link>
      <description>&lt;P&gt;Ugh, I've spent like a day trying to fix this and I can't get anywhere with it. I do have the {{ $rising_column$ &amp;gt; ?}} stuff in my query and that is working as expected. It's just this datetime stuff I can't make work. &lt;/P&gt;

&lt;P&gt;DB Connect 1.1.4 here&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 20:13:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166422#M186123</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-15T20:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166423#M186124</link>
      <description>&lt;P&gt;do you get any error in dbx.log? does it show you any error like ERROR PARSING  TIMESTAMP? OR anything?&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 21:01:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166423#M186124</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-15T21:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166424#M186125</link>
      <description>&lt;P&gt;got the real problem where splunk doesn't check the old date so need to set a props.conf. Try my updated answer&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2014 21:28:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166424#M186125</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-15T21:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166425#M186126</link>
      <description>&lt;P&gt;No errors in dbx.log unfortanetly. I added this to the dbx\props.conf file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::dbmon-tail://RO_DB/PostedOrders]
TIME_FORMAT = %Y%m%d %H%M%S
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure if this is correct, from the little reading I've done about props.conf I think it's correct, but when running the tail it still doesn't correctly place the event on the right day. Still just reads it all as today. I updated my original posted with the dbx\local\inputs.conf file I currently have.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 12:22:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166425#M186126</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-16T12:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166426#M186127</link>
      <description>&lt;P&gt;i have done some modification.&lt;/P&gt;

&lt;P&gt;if possible follow my step to clear the counter to monitor from starting if they come correctly. &lt;/P&gt;

&lt;P&gt;output.timestamp.format is not that important so ignore it for now&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 15:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166426#M186127</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-16T15:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166427#M186128</link>
      <description>&lt;P&gt;well, this just got worse ... after looking at your most recent modifications and trying to update my inputs.conf DB Connect blew up. It will not run at all anymore and give me the error&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DatabaseMonitorValidator returned status code 47 see splunkd.log for more details
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but splunkd.log doesn't contain anymore details ... This happened to me on Wednesday too. IMO this DB Connect app is extremely untrustworthy.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 18:40:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166427#M186128</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-16T18:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166428#M186129</link>
      <description>&lt;P&gt;check in dbx.log for any kind of error. It works great for many so shouldn't be disheartened with small failures&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 18:51:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166428#M186129</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-16T18:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166429#M186130</link>
      <description>&lt;P&gt;Well I uninstalled splunk and removed all files and reinstalled clean ... added the inputs.conf lines I have updated above ... worked once to import the first 20 items. But still with the date being indexed incorrectly. I added a output.timestamp.parse.format line and it blew up again. I'm officially giving up on the DB Connect app (I've been working on this since Monday).&lt;/P&gt;

&lt;P&gt;Thank you for your help linu1988 it was greatly appreciated, I up-voted your post but can't award the answer as I couldn't make it work properly.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 19:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166429#M186130</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-16T19:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166430#M186131</link>
      <description>&lt;P&gt;Did you set the props.conf in your app updated in your post? that is really required. Even after that it doesn't work i have to officially tell sorry and wait for some Splunk person to assist you.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 19:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166430#M186131</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-05-16T19:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166431#M186132</link>
      <description>&lt;P&gt;Yeah, I updated my original post to exactly how my inputs.conf and props.conf are reading right now. So after a new rebuild and setting it all back up again (as above), it is still pulling the dates in as Today but because I'm outputting the time to the event I see that it's saying the por_POSTING_DATE is today but that is not true. A quick select from the DB is showing the date as 2005-12-16 11:11:00 so I'm not sure why it's different now. Maybe my props.conf?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:39:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166431#M186132</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2020-09-28T16:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166432#M186133</link>
      <description>&lt;P&gt;por_POSTING_DATE if it is your datetime field it should be in epoch time format. You should set it as &lt;CODE&gt;TIME_FORMAT=%s&lt;/CODE&gt;. and add this as well in props.conf &lt;CODE&gt;MAX_DAYS_AGO = 5000&lt;/CODE&gt;. it should give you the exact date as your DB record. Hope it finally does the trick.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:39:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166432#M186133</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2020-09-28T16:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166433#M186134</link>
      <description>&lt;P&gt;I updated my props.conf (See above) and restarted splunk, same thing. It's showing the date / time from the output.timestamp in the event as "2014-05-20 11:00:48" but when looking at the DB it's actually returning "2005-12-21 08:52:00"&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2014 15:03:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166433#M186134</guid>
      <dc:creator>devicenul1</dc:creator>
      <dc:date>2014-05-20T15:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: DB Connect MS SQL Datetime</title>
      <link>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166434#M186135</link>
      <description>&lt;P&gt;your configuration is wrong. the source name is wrongly mentioned. just keep the below in your props.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[PostedOrders]&lt;BR /&gt;
MAX_DAYS_AGO = 5000&lt;BR /&gt;
TIME_FORMAT=%s&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;check for the oldest event after you index the records. &lt;/P&gt;

&lt;P&gt;sourcetype=PostedOrders|stats last(_time) as last_time by sourcetype|convert ctime(last_time)&lt;/P&gt;

&lt;P&gt;if you see 2005 timestamp that's it!!! All the best&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:40:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/DB-Connect-MS-SQL-Datetime/m-p/166434#M186135</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2020-09-28T16:40:29Z</dc:date>
    </item>
  </channel>
</rss>

