<?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: Problem with JSON file in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354780#M5674</link>
    <description>&lt;P&gt;I finally found a solution!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[json_flight_data]
SHOULD_LINEMERGE=false
NO_BINARY_CHECK=true
disabled=false
LINE_BREAKER=([.+,]+)(?=\{\"Id\")
SEDCMD-removeheader=s/^(\s*\{\s*+.+\"acList\":\[)//
SEDCMD-removefooter=s/(\s*\],\"totalAc\"(.+[\r\n]*)+)//
DATETIME_CONFIG=CURRENT
category=Structured
pulldown_type=true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Mar 2017 15:42:59 GMT</pubDate>
    <dc:creator>mblauw</dc:creator>
    <dc:date>2017-03-14T15:42:59Z</dc:date>
    <item>
      <title>Problem with JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354776#M5670</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I've got some problems with by RegEx commands on a JSON file. I'm trying to do a linebreak on each },{ value and remove the header and footer. The last two seem to be working quite well. I can't, however, get te linebreak to work..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-removefooter = s/(\s*\],\"totalAc\”(.+[\r\n]*)+)//
SEDCMD-removeheader = s/^(\s*\{\s*+.+\"acList\":\[)//
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, anybody knows good places to learn RegEx / SED?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"src":1,"feeds":[{"id":1,"name":"From Consolidator","polarPlot":false}],"srcFeed":1,"showSil":true,"showFlg":true,"showPic":true,"flgH":20,"flgW":85,"acList":[{"Id":4735333,"Rcvr":1,"HasSig":false,"Icao":"484165","Bad":false,"Reg":"PH-BXM","FSeen":"\/Date(1489492025217)\/","TSecs":12,"CMsgs":3,"Alt":0,"GAlt":493,"InHg":30.4133873,"AltT":0,"Lat":52.306179,"Long":4.76435,"PosTime":1489492025217,"Mlat":false,"Tisb":false,"Spd":0.0,"TrkH":false,"Type":"B738","Mdl":"Boeing 737NG 8K2/W","Man":"Boeing","CNum":"30355","Op":"KLM Royal Dutch Airlines","OpIcao":"KLM","Sqk":"","VsiT":0,"Dst":0.33,"Brng":168.5,"WTC":2,"Species":1,"Engines":"2","EngType":3,"EngMount":0,"Mil":false,"Cou":"Netherlands","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":true,"SpdTyp":0,"CallSus":false,"Trt":2,"Year":"2000"},{"Id":4735513,"Rcvr":1,"HasSig":false,"Icao":"484219","Bad":false,"FSeen":"\/Date(1489492025217)\/","TSecs":12,"CMsgs":5,"Alt":0,"GAlt":493,"InHg":30.4133873,"AltT":0,"Call":"HVK1","Lat":52.318241,"Long":4.74571,"PosTime":1489492037420,"Mlat":false,"Tisb":false,"Spd":18.0,"Trak":267.0,"TrkH":false,"Sqk":"","VsiT":0,"Dst":1.58,"Brng":310.3,"WTC":0,"Species":0,"EngType":0,"EngMount":0,"Mil":false,"Cou":"Netherlands","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":true,"SpdTyp":0,"CallSus":false,"Trt":2},{"Id":4736693,"Rcvr":1,"HasSig":false,"Icao":"4846B5","Bad":false,"Reg":"","FSeen":"\/Date(1489491909202)\/","TSecs":128,"CMsgs":30,"Alt":0,"GAlt":493,"InHg":30.4133873,"AltT":0,"Call":"MQ","Lat":52.298538,"Long":4.75374,"PosTime":1489492037420,"Mlat":false,"Tisb":false,"Spd":0.0,"Trak":160.0,"TrkH":false,"Type":"-GND","Mdl":"Ground Vehicle","Man":"","Sqk":"","VsiT":0,"Dst":1.34,"Brng":209.3,"WTC":0,"Species":7,"EngType":0,"EngMount":0,"Mil":false,"Cou":"Netherlands","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":true,"SpdTyp":0,"CallSus":false,"Trt":2},{"Id":4739173,"Rcvr":1,"HasSig":true,"Sig":152,"Icao":"485065","Bad":false,"Reg":"PH-EZZ","FSeen":"\/Date(1489491894046)\/","TSecs":143,"CMsgs":104,"Alt":6600,"GAlt":7093,"InHg":30.4133873,"AltT":0,"Call":"KLM33N","Lat":52.320526,"Long":4.641017,"PosTime":1489492036076,"Mlat":true,"Tisb":false,"Spd":115.0,"Trak":26.6,"TrkH":false,"Type":"E190","Mdl":"Embraer EMB-190 STD","Man":"Embraer","CNum":"19000654","From":"EHAM Amsterdam Airport Schiphol, Netherlands","To":"EKBI Billund, Denmark","Op":"KLM Cityhopper","OpIcao":"KLC","Sqk":"0140","Help":false,"Vsi":-631,"VsiT":0,"Dst":8.42,"Brng":278.8,"WTC":2,"Species":1,"Engines":"2","EngType":3,"EngMount":0,"Mil":false,"Cou":"Netherlands","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":false,"SpdTyp":0,"CallSus":true,"Trt":2,"Year":"2013"},{"Id":4740238,"Rcvr":1,"HasSig":false,"Icao":"48548E","Bad":false,"Reg":"PH-EXL","FSeen":"\/Date(1489491890436)\/","TSecs":147,"CMsgs":13,"Alt":4750,"GAlt":5258,"InHg":30.4278164,"AltT":0,"TAlt":2016,"Call":"KLM1873","Lat":52.300861,"Long":4.759769,"PosTime":1489491890436,"Mlat":false,"PosStale":true,"Tisb":false,"Spd":23.0,"Trak":59.1,"TrkH":false,"Type":"E75S","Mdl":"ERJ-175STD (170-200)","Man":"Embraer","CNum":"17000633","From":"EHAM Amsterdam Airport Schiphol, Netherlands","To":"EDDS Stuttgart, Germany","Op":"KLM Cityhopper","OpIcao":"KLC","Sqk":"3432","Help":false,"Vsi":0,"VsiT":0,"Dst":0.95,"Brng":195.1,"WTC":0,"Species":0,"EngType":0,"EngMount":0,"Mil":false,"Cou":"Netherlands","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":true,"SpdTyp":0,"CallSus":false,"Trt":5,"Year":"2017"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(....)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/","TSecs":22318,"CMsgs":1407,"Alt":0,"GAlt":493,"InHg":30.4133873,"AltT":0,"Call":"C4","Lat":52.315102,"Long":4.76486,"PosTime":1489492034733,"Mlat":false,"Tisb":false,"Spd":32.0,"Trak":87.0,"TrkH":false,"Sqk":"","VsiT":0,"Dst":0.68,"Brng":8.5,"WTC":0,"Species":0,"EngType":0,"EngMount":0,"Mil":false,"Cou":"Netherlands","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":true,"SpdTyp":0,"CallSus":false,"Trt":2},{"Id":4735491,"Rcvr":1,"HasSig":false,"Icao":"484203","Bad":false,"Reg":"","FSeen":"\/Date(1489469002040)\/","TSecs":23035,"CMsgs":1850,"Alt":0,"GAlt":493,"InHg":30.4133873,"AltT":0,"Call":"KV1","Lat":52.322311,"Long":4.74203,"PosTime":1489492037404,"Mlat":false,"Tisb":false,"Spd":7.0,"Trak":298.0,"TrkH":false,"Type":"-GND","Mdl":"Ground Vehicle","Man":"","Sqk":"","VsiT":0,"Dst":2.07,"Brng":315.4,"WTC":0,"Species":7,"EngType":0,"EngMount":0,"Mil":false,"Cou":"Netherlands","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":true,"SpdTyp":0,"CallSus":false,"Trt":2}],"totalAc":4729,"lastDv":"636250573166210860","shtTrlSec":65,"stm":1489492037873}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 14:36:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354776#M5670</guid>
      <dc:creator>mblauw</dc:creator>
      <dc:date>2017-03-14T14:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354777#M5671</link>
      <description>&lt;P&gt;@mblauw, can you please explain the reason for linebreak? Are you trying to parse/read JSON KV pairs?&lt;BR /&gt;
If so, you can try spath command instead.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath#7:_Extract_and_expand_JSON_events_with_multi-valued_fields"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath#7:_Extract_and_expand_JSON_events_with_multi-valued_fields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also, as you have mentioned, if you are getting data file itself as json, Splunk should already do search time field extraction for you. Refer to KV_MODE settings for JSON data in props.conf.&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:02:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354777#M5671</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-14T15:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354778#M5672</link>
      <description>&lt;P&gt;If this is really your exact text, then your problem is Windows: Take a VERY CLOSE look at all of your double-quote characters.  One of them is invalid as far as Splunk is concerned.  Fix that and see what happens.  Test your RegEx @ &lt;A href="http://www.RegEx101.com"&gt;http://www.RegEx101.com&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:11:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354778#M5672</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-14T15:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354779#M5673</link>
      <description>&lt;P&gt;It actually is a JSON reply from a REST API which is called every 5 seconds. When I parse my data through a JSON parser, I get a response from which I can extract multiple events with the following settings:&lt;/P&gt;

&lt;P&gt;LINE_BREAKER=([\r\n]+)(?=\s*{\s*[\r\n]&lt;EM&gt;\s&lt;/EM&gt;\"Id\")&lt;BR /&gt;
 SEDCMD-removeheader=s/^(\s*{\s*[\r\n]&lt;EM&gt;\"src\"(.+[\r\n]&lt;/EM&gt;)+)//&lt;BR /&gt;
 SEDCMD-removefooter=s/(\s*](.+[\r\n]*)+)//&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:13:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354779#M5673</guid>
      <dc:creator>mblauw</dc:creator>
      <dc:date>2020-09-29T13:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354780#M5674</link>
      <description>&lt;P&gt;I finally found a solution!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[json_flight_data]
SHOULD_LINEMERGE=false
NO_BINARY_CHECK=true
disabled=false
LINE_BREAKER=([.+,]+)(?=\{\"Id\")
SEDCMD-removeheader=s/^(\s*\{\s*+.+\"acList\":\[)//
SEDCMD-removefooter=s/(\s*\],\"totalAc\"(.+[\r\n]*)+)//
DATETIME_CONFIG=CURRENT
category=Structured
pulldown_type=true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:42:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354780#M5674</guid>
      <dc:creator>mblauw</dc:creator>
      <dc:date>2017-03-14T15:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with JSON file</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354781#M5675</link>
      <description>&lt;P&gt;Was it the bad double-quote character?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 15:47:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Problem-with-JSON-file/m-p/354781#M5675</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-14T15:47:34Z</dc:date>
    </item>
  </channel>
</rss>

