<?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 Index a DB-log in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Index-a-DB-log/m-p/95610#M19919</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;Just wondering if some of you have already indexed some logs which are stored in a DB and if so, what would be the best practice.&lt;/P&gt;

&lt;P&gt;The application is not logging into a file but in the DB. I'd like to index it as well in Splunk and I've seen that it can be done via scripting. The problem I encounter is I have either missing data or duplicated data. Indeed, If I run for instance every 10 minutes and collect the data for the last 10 minutes, it might happen that I miss a few milliseconds. If I decide to run the script every 9 minutes but collect the data for the last 10 minutes, I end up with duplicated data.&lt;/P&gt;

&lt;P&gt;Any idea on how to get this working?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Olivier&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2011 16:57:52 GMT</pubDate>
    <dc:creator>OL</dc:creator>
    <dc:date>2011-05-05T16:57:52Z</dc:date>
    <item>
      <title>Index a DB-log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-a-DB-log/m-p/95610#M19919</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;Just wondering if some of you have already indexed some logs which are stored in a DB and if so, what would be the best practice.&lt;/P&gt;

&lt;P&gt;The application is not logging into a file but in the DB. I'd like to index it as well in Splunk and I've seen that it can be done via scripting. The problem I encounter is I have either missing data or duplicated data. Indeed, If I run for instance every 10 minutes and collect the data for the last 10 minutes, it might happen that I miss a few milliseconds. If I decide to run the script every 9 minutes but collect the data for the last 10 minutes, I end up with duplicated data.&lt;/P&gt;

&lt;P&gt;Any idea on how to get this working?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Olivier&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2011 16:57:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-a-DB-log/m-p/95610#M19919</guid>
      <dc:creator>OL</dc:creator>
      <dc:date>2011-05-05T16:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Index a DB-log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-a-DB-log/m-p/95611#M19920</link>
      <description>&lt;P&gt;I would suggest that you alter your script in such a way as to make it pick up where it left off the last time. Reference the row_id, sequence number, or timestamp where you last left and grab anything greater than this value. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/wiki/Apps:DatabaseCollection"&gt;http://www.splunk.com/wiki/Apps:DatabaseCollection&lt;/A&gt; provides suggestions for this:&lt;/P&gt;

&lt;P&gt;If I had a table (a query result, actually) that looked like&lt;/P&gt;

&lt;P&gt;seqno, time, message&lt;/P&gt;

&lt;P&gt;then I could do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;oldmax = readmaxfile
max = select max(seqno) from table
select * from table where seqno &amp;gt; oldmax
writemaxfile (max)
for each of the returned results:
 format nicely ( kv pairs work well here! )
 write to stdout
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2011 17:31:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-a-DB-log/m-p/95611#M19920</guid>
      <dc:creator>jbsplunk</dc:creator>
      <dc:date>2011-05-05T17:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Index a DB-log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Index-a-DB-log/m-p/95612#M19921</link>
      <description>&lt;P&gt;Exactly what I wanted &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thx!!&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2011 07:26:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Index-a-DB-log/m-p/95612#M19921</guid>
      <dc:creator>OL</dc:creator>
      <dc:date>2011-05-06T07:26:45Z</dc:date>
    </item>
  </channel>
</rss>

