<?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: how to break json data comming from tcp input in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303242#M57276</link>
    <description>&lt;P&gt;try this,&lt;/P&gt;

&lt;P&gt;[ yoursourcetype]&lt;BR /&gt;
SHOULD_LINEMERGE=true&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
CHARSET=UTF-8&lt;BR /&gt;
INDEXED_EXTRACTIONS=json&lt;BR /&gt;
KV_MODE=none&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:53:18 GMT</pubDate>
    <dc:creator>sbbadri</dc:creator>
    <dc:date>2020-09-29T14:53:18Z</dc:date>
    <item>
      <title>how to break json data comming from tcp input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303241#M57275</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I'm trying to break json events comming from tcp input into seperate events. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {
    "action" : "STOP",
    "source" : "AS_PLANNED",
    "timestamp" : "2017-03-24T08:29:59.977+01:00",
    "productionNumber" : "14801720125",
    "productionType" : "Radio",
    "eventId" : "1179469773327",
    "title" : "Some title",
    "flowPublicationId" : "1179469742812",
    "channelPresentationCode" : "xx",
    "channelPresentationName" : "xxyy",
    "timeAllocationType" : "Segment of program",
    "actualTime" : "2017-03-24T08:30:00.000+01:00",
    "startTimeAnnounced" : "2017-03-24T08:06:00.000+01:00",
    "startTimePlanned" : "2017-03-24T08:06:00.000+01:00",
    "stopTimePlanned" : "2017-03-24T08:30:00.000+01:00",
    "broadcastDate" : "2017-03-24",
    "live" : false,
    "quickReprise" : false,
    "streamingLive" : false,
    "streamingOD" : true,
    "streamingDestination" : " (WEBCMS)",
    "numberOfBlocks" : "8",
    "blockPartNumber" : "5",
    "blockId" : "1179469768813"
  }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the json is pretty printed with spaces and linebreaks.&lt;BR /&gt;
It works fine if I ommit the spaces and linebreaks with the default json sourcetype, but with the pretty printet version the event get's split into several events.&lt;/P&gt;

&lt;P&gt;I have figured out I have to create a custom sourcetype and use a custom LINE_BREAKER as stated here &lt;A href="https://answers.splunk.com/answers/171197/how-to-get-two-lines-of-json-to-break-as-two-event.html"&gt;https://answers.splunk.com/answers/171197/how-to-get-two-lines-of-json-to-break-as-two-event.html&lt;/A&gt;. &lt;BR /&gt;
But I was not able to find the magic rex to ommit spaces and linebreaks.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 11:09:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303241#M57275</guid>
      <dc:creator>preben12</dc:creator>
      <dc:date>2017-07-11T11:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to break json data comming from tcp input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303242#M57276</link>
      <description>&lt;P&gt;try this,&lt;/P&gt;

&lt;P&gt;[ yoursourcetype]&lt;BR /&gt;
SHOULD_LINEMERGE=true&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
CHARSET=UTF-8&lt;BR /&gt;
INDEXED_EXTRACTIONS=json&lt;BR /&gt;
KV_MODE=none&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:53:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303242#M57276</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T14:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to break json data comming from tcp input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303243#M57277</link>
      <description>&lt;P&gt;You should apply base configs at the app level in &lt;CODE&gt;props.conf&lt;/CODE&gt; to get the linebreaking your looking for &lt;/P&gt;

&lt;P&gt;So as a basic example, under &lt;CODE&gt;/opt/splunk/etc/apps/&amp;lt;APP_NAME&amp;gt;/local/props.conf&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You should have the following stanza &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_sourcetype]
TIME_PREFIX = ^
MAX_TIMESTAMP_LOOKAHEAD = 25
TZ = GMT
# A performance tweak is to disable SHOULD_LINEMERGE and then set the 
# LINE_BREAKER to "line ending characters coming before a new time stamp"
# (note the direct link of the TIME_FORMAT to the regex of LINE_BREAKER).
TIME_FORMAT = %Y-%m-%d %H:%M:%S,%3N
LINE_BREAKER = ([\r\n]+){
SHOULD_LINEMERGE = False
# 10000 is default, should be set on a case by case basis
TRUNCATE = 10000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since this is TCP data, it will most likely not have a timestamp baked into the event, so the timestamp will be added at the time the event was indexed.. I would suggest you have a dedicated syslog server which the tcp data is sent to and log it there, then install a forwarder on that syslog server and send the data to Splunk&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 14:02:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303243#M57277</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2017-07-11T14:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to break json data comming from tcp input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303244#M57278</link>
      <description>&lt;P&gt;Why would you set &lt;CODE&gt;SHOULD_LINEMERGE = true&lt;/CODE&gt;?? &lt;/P&gt;

&lt;P&gt;This would result in single line events and moot the point of Splunk.. A better approach would be to capture the entire json message as a single event &lt;/P&gt;

&lt;P&gt;Also, why disable &lt;CODE&gt;NO_BINARY_CHECK&lt;/CODE&gt;? This stanza has trouble written all over it &lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 14:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303244#M57278</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2017-07-11T14:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to break json data comming from tcp input</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303245#M57279</link>
      <description>&lt;P&gt;Works fine. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 06:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-break-json-data-comming-from-tcp-input/m-p/303245#M57279</guid>
      <dc:creator>preben12</dc:creator>
      <dc:date>2017-07-12T06:07:37Z</dc:date>
    </item>
  </channel>
</rss>

