<?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 Structured data header extraction - WARN CsvLineBreaker - Parser warning: Encountered unescaped quotation mark in field in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/Structured-data-header-extraction-WARN-CsvLineBreaker-Parser/m-p/452139#M20293</link>
    <description>&lt;P&gt;I Recently came across an issue where the following warning message was spamming my forwarder's splunkd.log for a structured data header extraction configured to use a W3C extended log format message. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;10-25-2018 09:47:40.933 +1300 WARN  CsvLineBreaker - Parser warning: Encountered unescaped quotation mark in field while parsing. This may cause inaccurate field extractions or corrupt/merged events. - data_source="...", data_host="...", data_sourcetype="..."&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Dummy W3C format field example:&lt;BR /&gt;
&lt;CODE&gt;"2018-10-25" "00:00:00" "[{\"rule_id\":\"37572\",\"type\":\"AD_FORWARD_TO_DC\",\"forward_to_dc_id\":\"447780\"}]"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Forwarder's props.conf:&lt;BR /&gt;
&lt;CODE&gt;[mysouretype]&lt;BR /&gt;
INDEXED_EXTRACTIONS = W3C &lt;BR /&gt;
FIELD_DELIMITER = whitespace &lt;BR /&gt;
FIELD_QUOTE = " &lt;BR /&gt;
FIELD_NAMES = date, time, quoted_field&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Raised this with Splunk support as a possible bug, as it appeared to me that the double quote in the log's field were back slashed escaped. &lt;/P&gt;</description>
    <pubDate>Thu, 25 Oct 2018 03:03:17 GMT</pubDate>
    <dc:creator>gcato</dc:creator>
    <dc:date>2018-10-25T03:03:17Z</dc:date>
    <item>
      <title>Structured data header extraction - WARN CsvLineBreaker - Parser warning: Encountered unescaped quotation mark in field</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Structured-data-header-extraction-WARN-CsvLineBreaker-Parser/m-p/452139#M20293</link>
      <description>&lt;P&gt;I Recently came across an issue where the following warning message was spamming my forwarder's splunkd.log for a structured data header extraction configured to use a W3C extended log format message. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;10-25-2018 09:47:40.933 +1300 WARN  CsvLineBreaker - Parser warning: Encountered unescaped quotation mark in field while parsing. This may cause inaccurate field extractions or corrupt/merged events. - data_source="...", data_host="...", data_sourcetype="..."&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Dummy W3C format field example:&lt;BR /&gt;
&lt;CODE&gt;"2018-10-25" "00:00:00" "[{\"rule_id\":\"37572\",\"type\":\"AD_FORWARD_TO_DC\",\"forward_to_dc_id\":\"447780\"}]"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Forwarder's props.conf:&lt;BR /&gt;
&lt;CODE&gt;[mysouretype]&lt;BR /&gt;
INDEXED_EXTRACTIONS = W3C &lt;BR /&gt;
FIELD_DELIMITER = whitespace &lt;BR /&gt;
FIELD_QUOTE = " &lt;BR /&gt;
FIELD_NAMES = date, time, quoted_field&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Raised this with Splunk support as a possible bug, as it appeared to me that the double quote in the log's field were back slashed escaped. &lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 03:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Structured-data-header-extraction-WARN-CsvLineBreaker-Parser/m-p/452139#M20293</guid>
      <dc:creator>gcato</dc:creator>
      <dc:date>2018-10-25T03:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Structured data header extraction - WARN CsvLineBreaker - Parser warning: Encountered unescaped quotation mark in field</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/Structured-data-header-extraction-WARN-CsvLineBreaker-Parser/m-p/452140#M20294</link>
      <description>&lt;P&gt;Splunk support responded to my issue and it is not a bug, as quote characters in W3C extended log file format are escaped with a repeated quote, i.e "", not \"  &lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.w3.org/TR/WD-logfile.html"&gt;https://www.w3.org/TR/WD-logfile.html&lt;/A&gt; &lt;BR /&gt;
... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;string&amp;gt; = '"' &amp;lt;schar&amp;gt;* '"' 

&amp;lt;schar&amp;gt; = xchar | '"' '"' 
Strings are output in quoted form. If a string contains a quotation character the character is repeated. This format is unambiguous since fields are by definition separated by whitespace. 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is similar to the CSV specification: &lt;A href="https://tools.ietf.org/html/rfc4180"&gt;https://tools.ietf.org/html/rfc4180&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote. For example:
 "aaa","b""bb","ccc"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Interestingly, in JSON format it would be \", so in my case, to maintain the backslash, the W3C formatted field should be \"".  This tested okay when I changed the field in my test log.&lt;/P&gt;

&lt;P&gt;As I cannot change the incoming log file - and I do not want to preprocess the file - Splunk support suggested the following method to suppress the CsvLineBreaker warning.&lt;/P&gt;

&lt;P&gt;The log level can be adjusted to suppress the warning message for the category as below: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cd $SPLUNK_HOME/bin
splunk show log-level CsvLineBreaker
splunk set log-level CsvLineBreaker -level CRIT 
splunk show log-level CsvLineBreaker
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Log level will get back to "WARN" after splunk UF has to be restarted. &lt;/P&gt;

&lt;P&gt;You can change the log level permanently in the following way in this case.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cd $SPLUNK_HOME/etc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please add the following line anyware in log.cfg and restart UF.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;category.CsvLineBreaker=CRIT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once UF is restarted after this change, please ensure that the log level has been adjusted. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;splunk show log-level CsvLineBreaker
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please refer to the following URL:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.splunk.com/blog/2008/09/22/enabling-debug-messages.html"&gt;https://www.splunk.com/blog/2008/09/22/enabling-debug-messages.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2018 03:19:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/Structured-data-header-extraction-WARN-CsvLineBreaker-Parser/m-p/452140#M20294</guid>
      <dc:creator>gcato</dc:creator>
      <dc:date>2018-10-25T03:19:54Z</dc:date>
    </item>
  </channel>
</rss>

