<?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: Indexing Json objects to Splunk in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-Json-objects-to-Splunk/m-p/147903#M30087</link>
    <description>&lt;P&gt;For me removing the &lt;CODE&gt;LINE_BREAKER = "(^){"&lt;/CODE&gt; from the props.conf file did the trick&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2013 08:53:07 GMT</pubDate>
    <dc:creator>leustean</dc:creator>
    <dc:date>2013-11-20T08:53:07Z</dc:date>
    <item>
      <title>Indexing Json objects to Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-Json-objects-to-Splunk/m-p/147901#M30085</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;Until recently I used to print to standard output a single json object, effectively having it indexed into Splunk and it worked great for me. Each field in the Json object was correctly picked up by Splunk and  the Json object was turned into an event.&lt;/P&gt;

&lt;P&gt;My props.conf looks like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[default]
KV_MODE = json
LINE_BREAKER = "(^){"
NO_BINARY_CHECK = 1
TRUNCATE = 0
SHOULD_LINEMERGE = false    

[my-source]
DATETIME_CONFIG = CURRENT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But since I needed to extend the functionality I began printing in a loop several json objects :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;for st in stats:            
   # Index each json object to Splunk
    print (json.dumps(st))
    sys.stdout.flush()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The effect is that now all json objects are mashed up together in a single event no field is detected .&lt;/P&gt;

&lt;P&gt;Could someone provide input on how to have every Json Object in a separately Event ?&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2013 15:44:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Indexing-Json-objects-to-Splunk/m-p/147901#M30085</guid>
      <dc:creator>leustean</dc:creator>
      <dc:date>2013-11-19T15:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Indexing Json objects to Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-Json-objects-to-Splunk/m-p/147902#M30086</link>
      <description>&lt;P&gt;I would do it this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my-source]
DATETIME_CONFIG = CURRENT
KV_MODE = json
NO_BINARY_CHECK = 1
TRUNCATE = 0
SHOULD_LINEMERGE = true
BREAK_ONLY_BEFORE = someregularexpression
MAX_EVENTS = 1000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First, I would not put anything in the default stanza unless you mean for it to apply to every input forever. &lt;/P&gt;

&lt;P&gt;Second, the LINE_BREAKER is longer useful, and Splunk &lt;EM&gt;does&lt;/EM&gt; need to line-merge events. So to define the split between events, you need to tell Splunk what to look for. I usually use &lt;CODE&gt;BREAK_ONLY_BEFORE&lt;/CODE&gt;, which should be set to a regular expression that matches a string that will only (and always) appear on the first line of each JSON event. Note that regular expression can appear anywhere within the first line - it doesn't have to be at the beginning - and Splunk will still break at the beginning of the line. Finally, &lt;CODE&gt;MAX_EVENTS&lt;/CODE&gt; is not really the maximum number of events - it is the maximum number of lines in an event. So I made it larger than the default of 256, but that might not be necessary for you.&lt;/P&gt;

&lt;P&gt;In the manual, you might want to look at the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/Overviewofeventprocessing" target="_blank"&gt;event processing section&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Indexing-Json-objects-to-Splunk/m-p/147902#M30086</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2020-09-28T15:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Indexing Json objects to Splunk</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-Json-objects-to-Splunk/m-p/147903#M30087</link>
      <description>&lt;P&gt;For me removing the &lt;CODE&gt;LINE_BREAKER = "(^){"&lt;/CODE&gt; from the props.conf file did the trick&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 08:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Indexing-Json-objects-to-Splunk/m-p/147903#M30087</guid>
      <dc:creator>leustean</dc:creator>
      <dc:date>2013-11-20T08:53:07Z</dc:date>
    </item>
  </channel>
</rss>

