<?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 Where does Splunk log errors about malformed JSON input data? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Where-does-Splunk-log-errors-about-malformed-JSON-input-data/m-p/233071#M45446</link>
    <description>&lt;P&gt;I sent two events in JSON format to Splunk (Enterprise 6.4) via TCP. The second event was deliberately malformed: a string value was missing its closing quote.&lt;/P&gt;

&lt;P&gt;The first event was successfully indexed. As expected, the second wasn't.&lt;/P&gt;

&lt;P&gt;How do I troubleshoot this? For example, which Splunk log records the failure to ingest the second event?&lt;/P&gt;

&lt;P&gt;If I send similarly malformed event data to the HTTP Event Collector (EC) as two events batched in a single request:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"time":1459241926.498019000,"sourcetype":"my_test","index":"test","event":{"myfield":"good"}}
{"time":1459241926.498019000,"sourcetype":"my_test","index":"test","event":{"myfield":"bad}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(note the deliberately missing closing quote after the bad value)&lt;/P&gt;

&lt;P&gt;then, again, as expected, only the first event gets indexed. Unexpectedly, though, EC responds with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"text":"Success","code":0}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;whereas, if I reverse the order of the JSON lines (putting the event with the bad value first), I get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"text":"Invalid data format","code":6,"invalid-event-number":0}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(For JSON parsing errors in EC input, I've seen that the &lt;CODE&gt;data.num_of_parser_errors&lt;/CODE&gt; metric in the &lt;CODE&gt;_introspection&lt;/CODE&gt; index for that time period gets incremented. But that's all the evidence I can see: I don't see the specific error details logged anywhere.)&lt;/P&gt;</description>
    <pubDate>Fri, 06 May 2016 08:59:40 GMT</pubDate>
    <dc:creator>Graham_Hanningt</dc:creator>
    <dc:date>2016-05-06T08:59:40Z</dc:date>
    <item>
      <title>Where does Splunk log errors about malformed JSON input data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Where-does-Splunk-log-errors-about-malformed-JSON-input-data/m-p/233071#M45446</link>
      <description>&lt;P&gt;I sent two events in JSON format to Splunk (Enterprise 6.4) via TCP. The second event was deliberately malformed: a string value was missing its closing quote.&lt;/P&gt;

&lt;P&gt;The first event was successfully indexed. As expected, the second wasn't.&lt;/P&gt;

&lt;P&gt;How do I troubleshoot this? For example, which Splunk log records the failure to ingest the second event?&lt;/P&gt;

&lt;P&gt;If I send similarly malformed event data to the HTTP Event Collector (EC) as two events batched in a single request:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"time":1459241926.498019000,"sourcetype":"my_test","index":"test","event":{"myfield":"good"}}
{"time":1459241926.498019000,"sourcetype":"my_test","index":"test","event":{"myfield":"bad}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(note the deliberately missing closing quote after the bad value)&lt;/P&gt;

&lt;P&gt;then, again, as expected, only the first event gets indexed. Unexpectedly, though, EC responds with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"text":"Success","code":0}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;whereas, if I reverse the order of the JSON lines (putting the event with the bad value first), I get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"text":"Invalid data format","code":6,"invalid-event-number":0}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(For JSON parsing errors in EC input, I've seen that the &lt;CODE&gt;data.num_of_parser_errors&lt;/CODE&gt; metric in the &lt;CODE&gt;_introspection&lt;/CODE&gt; index for that time period gets incremented. But that's all the evidence I can see: I don't see the specific error details logged anywhere.)&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 08:59:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Where-does-Splunk-log-errors-about-malformed-JSON-input-data/m-p/233071#M45446</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2016-05-06T08:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Where does Splunk log errors about malformed JSON input data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Where-does-Splunk-log-errors-about-malformed-JSON-input-data/m-p/233072#M45447</link>
      <description>&lt;P&gt;I think I'll leave this question up for a few days longer as a testament to my own ignorance, and then delete it.&lt;/P&gt;

&lt;P&gt;I might ask a new question later around similar issues, based on my recent, slightly better understanding. (For example, although much of my question is based on bogus assumptions, that HEC behavior I reported still looks dodgy to me.)&lt;/P&gt;

&lt;P&gt;On with the self-flagellation:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;I sent two events...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;No, I didn't.&lt;/P&gt;

&lt;P&gt;I sent two lines of JSON, each ending in &lt;CODE&gt;\r\n&lt;/CODE&gt;, but, in &lt;CODE&gt;props.conf&lt;/CODE&gt;, I had failed to specify &lt;CODE&gt;SHOULD_LINEMERGE = false&lt;/CODE&gt;. So the two lines were being treated as a single event.&lt;/P&gt;

&lt;P&gt;If I had bothered to look at the &lt;CODE&gt;_raw&lt;/CODE&gt; field, I would have noticed that the JSON line with the &lt;CODE&gt;"bad&lt;/CODE&gt; (missing closing quote) value was appended to the "good" line, in a single event.&lt;/P&gt;

&lt;P&gt;After adding &lt;CODE&gt;SHOULD_LINEMERGE = false&lt;/CODE&gt; and resending the data, I get two events. The first event has a &lt;CODE&gt;myfield&lt;/CODE&gt; value of &lt;CODE&gt;good&lt;/CODE&gt;. The second event has no &lt;CODE&gt;myfield&lt;/CODE&gt; value.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;The first event was successfully indexed. As expected, the second wasn't.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;My expectation was wrong.&lt;/P&gt;

&lt;P&gt;As described above, after adding &lt;CODE&gt;SHOULD_LINEMERGE = false&lt;/CODE&gt;, the second event (with the missing closing quote) &lt;EM&gt;is&lt;/EM&gt; indexed. It just doesn't have a &lt;CODE&gt;myfield&lt;/CODE&gt; value, because the JSON is malformed.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2016 07:26:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Where-does-Splunk-log-errors-about-malformed-JSON-input-data/m-p/233072#M45447</guid>
      <dc:creator>Graham_Hanningt</dc:creator>
      <dc:date>2016-05-10T07:26:14Z</dc:date>
    </item>
  </channel>
</rss>

