<?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: Splunk DB Connect Output formatting values - what do they mean? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55517#M708</link>
    <description>&lt;H3&gt;1) Key-Value format&lt;/H3&gt;

&lt;P&gt;DB Connect formats the database results by generating key-value pairs in the form of &lt;CODE&gt;&amp;lt;Column-Name&amp;gt;=&amp;lt;Column-Value&amp;gt;&lt;/CODE&gt;. The value is quoted if it contains certain characters. Those key value pairs are concatenated (seperated by a space). If &lt;CODE&gt;output.timestamp&lt;/CODE&gt; is enabled, then the timestamp value will be printed at the beginning of the line.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-04-05T15:00:23.000 ID=4711 username=wuzi123 message="User has been disabled"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The sourcetype &lt;CODE&gt;dbmon:kv&lt;/CODE&gt; contains the necessary index- and search-time settings to deal with this format. It can either be used directly (by simply omitting the sourcetype for the input) or by copying it's settings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dbmon:kv]
SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H3&gt;2) Multiline Key-Value format&lt;/H3&gt;

&lt;P&gt;Essentially the same as the regular key-value format with the exception that the key-value pairs are seperated by a newline and there is no quoting of values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-04-05T15:00:23.000
ID=4711
username=wuzi123
message=User has been disabled
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The sourcetype &lt;CODE&gt;dbmon:mkv&lt;/CODE&gt; contains the necessary index- and search-time settings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dbmon:mkv]
KV_MODE = none
REPORT-mkv = dbx-mkv
SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]---91827349873-dbx-end-of-event---[\r\n])
LINE_BREAKER_LOOKBEHIND = 10000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H3&gt;3) CSV&lt;/H3&gt;

&lt;P&gt;The values of the database result are format as comma separated values (regular CSV with quoting):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-04-05T15:00:23.000,"4711","wuzi123","User has been disabled"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field extraction for this format has to be done manually. The best option here is a transforms.conf stanza with &lt;CODE&gt;FIELDS&lt;/CODE&gt; and &lt;CODE&gt;DELIMS&lt;/CODE&gt;.&lt;/P&gt;

&lt;H3&gt;3a) CSV with Headers&lt;/H3&gt;

&lt;P&gt;Does the same as CSV, but it will write the a header line into each file that is being generated containing a comma-separated list of the columns names from the database result.&lt;/P&gt;

&lt;H3&gt;4) Template&lt;/H3&gt;

&lt;P&gt;This format is the most flexible one, as it allows you to generate any format in the &lt;CODE&gt;output.template&lt;/CODE&gt; option. The template should contain replacement tokens in the form of &lt;CODE&gt;$&amp;lt;Column-Name&amp;gt;$&lt;/CODE&gt;. Those tokens are being replaced with the corresponding column value.&lt;/P&gt;

&lt;P&gt;Example Template:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;An even occurred at $timestamp$. User $user$ ID $ID$: $message$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;would produce&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;An even occurred at 2013-04-05T15:00:23.000. User wuzi123 ID 4711: User has been disabled
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;DB Connect ships with a props.conf stanza that handles line-breaking for this format. The settings should be copied the sourcetype used for the database input.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::...tpl_*.dbmonevt]
SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]---91827349873-dbx-end-of-event---[\r\n])
HEADER_MODE = firstline
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 05 Apr 2013 23:12:00 GMT</pubDate>
    <dc:creator>ziegfried</dc:creator>
    <dc:date>2013-04-05T23:12:00Z</dc:date>
    <item>
      <title>Splunk DB Connect Output formatting values - what do they mean?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55516#M707</link>
      <description>&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Configuredatabasemonitoring"&gt;http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Configuredatabasemonitoring&lt;/A&gt; does not describe what the different Output formats are doing.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Output formatting

These settings determine how the results are converted into a text-based format Splunk can index.

Formats

    * Key-Value based
    * Multiline Key-Value based
    * CSV
    * Template based
    * Timestamp output 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Initially I chose Key-Value based assuming that DB Connect would create the Key from the Column name and the Value from the data in the column.&lt;/P&gt;

&lt;P&gt;I then noticed that varchar fields with new lines were being truncated.&lt;BR /&gt;
To fix this I had to:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Delete all my Database Inputs&lt;/LI&gt;
&lt;LI&gt;Stop Splunk&lt;/LI&gt;
&lt;LI&gt;run &lt;CODE&gt;splunk clean eventdata&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Delete the persistent state for the Database Inputs (see &lt;A href="http://splunk-base.splunk.com/answers/68572/splunk-db-connect-how-to-reset-tailrising-state"&gt;How to reset tail.rising&lt;/A&gt;)&lt;/LI&gt;
&lt;LI&gt;Start Splunk&lt;/LI&gt;
&lt;LI&gt;Create all my Database Inputs - this time with "Multi-line Key-Value format"&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;So my question is: What do the different values of Output Format mean and can anyone provide guidance on when to select the different values? (Ideally this should be in the &lt;A href="http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Configuredatabasemonitoring"&gt;Documentation - Configuring Database Monitoring&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2013 06:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55516#M707</guid>
      <dc:creator>baerrach</dc:creator>
      <dc:date>2013-03-08T06:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Output formatting values - what do they mean?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55517#M708</link>
      <description>&lt;H3&gt;1) Key-Value format&lt;/H3&gt;

&lt;P&gt;DB Connect formats the database results by generating key-value pairs in the form of &lt;CODE&gt;&amp;lt;Column-Name&amp;gt;=&amp;lt;Column-Value&amp;gt;&lt;/CODE&gt;. The value is quoted if it contains certain characters. Those key value pairs are concatenated (seperated by a space). If &lt;CODE&gt;output.timestamp&lt;/CODE&gt; is enabled, then the timestamp value will be printed at the beginning of the line.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-04-05T15:00:23.000 ID=4711 username=wuzi123 message="User has been disabled"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The sourcetype &lt;CODE&gt;dbmon:kv&lt;/CODE&gt; contains the necessary index- and search-time settings to deal with this format. It can either be used directly (by simply omitting the sourcetype for the input) or by copying it's settings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dbmon:kv]
SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H3&gt;2) Multiline Key-Value format&lt;/H3&gt;

&lt;P&gt;Essentially the same as the regular key-value format with the exception that the key-value pairs are seperated by a newline and there is no quoting of values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-04-05T15:00:23.000
ID=4711
username=wuzi123
message=User has been disabled
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The sourcetype &lt;CODE&gt;dbmon:mkv&lt;/CODE&gt; contains the necessary index- and search-time settings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[dbmon:mkv]
KV_MODE = none
REPORT-mkv = dbx-mkv
SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]---91827349873-dbx-end-of-event---[\r\n])
LINE_BREAKER_LOOKBEHIND = 10000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H3&gt;3) CSV&lt;/H3&gt;

&lt;P&gt;The values of the database result are format as comma separated values (regular CSV with quoting):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-04-05T15:00:23.000,"4711","wuzi123","User has been disabled"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field extraction for this format has to be done manually. The best option here is a transforms.conf stanza with &lt;CODE&gt;FIELDS&lt;/CODE&gt; and &lt;CODE&gt;DELIMS&lt;/CODE&gt;.&lt;/P&gt;

&lt;H3&gt;3a) CSV with Headers&lt;/H3&gt;

&lt;P&gt;Does the same as CSV, but it will write the a header line into each file that is being generated containing a comma-separated list of the columns names from the database result.&lt;/P&gt;

&lt;H3&gt;4) Template&lt;/H3&gt;

&lt;P&gt;This format is the most flexible one, as it allows you to generate any format in the &lt;CODE&gt;output.template&lt;/CODE&gt; option. The template should contain replacement tokens in the form of &lt;CODE&gt;$&amp;lt;Column-Name&amp;gt;$&lt;/CODE&gt;. Those tokens are being replaced with the corresponding column value.&lt;/P&gt;

&lt;P&gt;Example Template:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;An even occurred at $timestamp$. User $user$ ID $ID$: $message$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;would produce&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;An even occurred at 2013-04-05T15:00:23.000. User wuzi123 ID 4711: User has been disabled
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;DB Connect ships with a props.conf stanza that handles line-breaking for this format. The settings should be copied the sourcetype used for the database input.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::...tpl_*.dbmonevt]
SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]---91827349873-dbx-end-of-event---[\r\n])
HEADER_MODE = firstline
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2013 23:12:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55517#M708</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-04-05T23:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Output formatting values - what do they mean?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55518#M709</link>
      <description>&lt;P&gt;Any updates to the answer when the column values contain newlines, i.e. from the original question "I then noticed that varchar fields with new lines were being truncated."&lt;/P&gt;

&lt;P&gt;For me only Multiline Key-Value based worked&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 10:23:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55518#M709</guid>
      <dc:creator>baerrach</dc:creator>
      <dc:date>2013-04-08T10:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Output formatting values - what do they mean?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55519#M710</link>
      <description>&lt;P&gt;When using the CSV format, how does one link the inputs.conf and transforms.conf files?  Should the respective files have identical stanza names?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2013 16:39:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55519#M710</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2013-07-29T16:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Output formatting values - what do they mean?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55520#M711</link>
      <description>&lt;P&gt;Clear explanations with nice examples.  Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jan 2015 04:30:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55520#M711</guid>
      <dc:creator>anwarmian</dc:creator>
      <dc:date>2015-01-11T04:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect Output formatting values - what do they mean?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55521#M712</link>
      <description>&lt;P&gt;Did you ever find a solution to the issue where column values contain new lines?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 22:49:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-DB-Connect-Output-formatting-values-what-do-they-mean/m-p/55521#M712</guid>
      <dc:creator>jhambrick</dc:creator>
      <dc:date>2016-01-27T22:49:00Z</dc:date>
    </item>
  </channel>
</rss>

