<?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: Break JSON file into separate events, removing the header and footer in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Break-JSON-file-into-separate-events-removing-the-header-and/m-p/345085#M102235</link>
    <description>&lt;P&gt;It's working! Thank you so much! Where have you learned to build up those SED/RegEx commands? &lt;/P&gt;</description>
    <pubDate>Sat, 11 Mar 2017 10:23:15 GMT</pubDate>
    <dc:creator>mblauw</dc:creator>
    <dc:date>2017-03-11T10:23:15Z</dc:date>
    <item>
      <title>Break JSON file into separate events, removing the header and footer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-JSON-file-into-separate-events-removing-the-header-and/m-p/345083#M102233</link>
      <description>&lt;P&gt;I've just started using RegEx and I'm currently looking on a way to extract multiple events from my JSON flight information logs. Here is my props.conf:&lt;/P&gt;

&lt;P&gt;[_json_flight_data]&lt;BR /&gt;
BREAK_ONLY_BEFORE_DATE = false&lt;BR /&gt;
BREAK_ONLY_BEFORE = ({|[\s+{)&lt;BR /&gt;
MUST_BREAK_AFTER = (}|}\s+])&lt;BR /&gt;
SEDCMD-remove_header = s/({\s+.+\s+.+\s+{\s+.+\s+.+\s+.+\s+}\s+.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+.+\s+[)//g&lt;BR /&gt;
SEDCMD-remove_trailing_commas = s/},/}/g&lt;BR /&gt;
SEDCMD-remove_footer = s/(].\s+.+\s+.+\s+.+\s+.+\s+})//g&lt;/P&gt;

&lt;P&gt;(I know the style is VERY ugly haha.. But it should still work, right?)&lt;/P&gt;

&lt;P&gt;Here's a part from my log:&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": 4736016,
         "Rcvr": 1,
         "HasSig": false,
         "Icao": "484410",
         "Bad": false,
         "Reg": "PH-AOB",
         "FSeen": "/Date(1489141837845)/",
         "TSecs": 335,
         "CMsgs": 105,
         "Alt": 0,
         "GAlt": 434,
         "InHg": 30.35433,
         "AltT": 0,
         "Call": "KLM729",
         "Lat": 52.313339,
         "Long": 4.76521,
         "PosTime": 1489141920517,
         "Mlat": false,
         "PosStale": true,
         "Tisb": false,
         "Spd": 2,
         "Trak": 213,
         "TrkH": false,
         "Type": "A332",
         "Mdl": "Airbus A330 203",
         "Man": "Airbus",
         "CNum": "686",
         "From": "EHAM Amsterdam Airport Schiphol, Netherlands",
         "To": "TNCM Princess Juliana, Saint Martin, Sint Maarten",
         "Op": "KLM Royal Dutch Airlines",
         "OpIcao": "KLM",
         "Sqk": "",
         "VsiT": 0,
         "Dst": 0.49,
         "Brng": 14.6,
         "WTC": 3,
         "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": "2005"
      },

(many more events ...)

      {
         "Id": 4735491,
         "Rcvr": 1,
         "HasSig": false,
         "Icao": "484203",
         "Bad": false,
         "Reg": "",
         "FSeen": "/Date(1489114921456)/",
         "TSecs": 27251,
         "CMsgs": 6334,
         "Alt": 0,
         "GAlt": 434,
         "InHg": 30.35433,
         "AltT": 0,
         "Call": "KV1",
         "Lat": 52.31559,
         "Long": 4.74158,
         "PosTime": 1489142165220,
         "Mlat": false,
         "Tisb": false,
         "Spd": 15,
         "Trak": 177,
         "TrkH": false,
         "Type": "-GND",
         "Mdl": "Ground Vehicle",
         "Man": "",
         "Sqk": "3220",
         "Help": false,
         "VsiT": 0,
         "Dst": 1.65,
         "Brng": 296.1,
         "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": 6822,
   "lastDv": "636247117248607567",
   "shtTrlSec": 65,
   "stm": 1489142172423
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I try to index my log with these settings, the linebreaking is done right, but the header and footer removal is not being done at all.&lt;/P&gt;

&lt;P&gt;Does anybody know where I'm doing this wrong?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:09:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-JSON-file-into-separate-events-removing-the-header-and/m-p/345083#M102233</guid>
      <dc:creator>mblauw</dc:creator>
      <dc:date>2020-09-29T13:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Break JSON file into separate events, removing the header and footer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-JSON-file-into-separate-events-removing-the-header-and/m-p/345084#M102234</link>
      <description>&lt;P&gt;Give this a try. It's missing timestamp related configurations, add per your requirements)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ &amp;lt;SOURCETYPE NAME&amp;gt; ]
SHOULD_LINEMERGE=false
NO_BINARY_CHECK=true
disabled=false
LINE_BREAKER=([\r\n]+)(?=\s*\{\s*[\r\n]*\s*\"Id\")
SEDCMD-removeheader=s/^(\s*\{\s*[\r\n]*\"src\"(.+[\r\n]*)+)//
SEDCMD-removefooter=s/(\s*\](.+[\r\n]*)+)//
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Mar 2017 17:40:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-JSON-file-into-separate-events-removing-the-header-and/m-p/345084#M102234</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-10T17:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Break JSON file into separate events, removing the header and footer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-JSON-file-into-separate-events-removing-the-header-and/m-p/345085#M102235</link>
      <description>&lt;P&gt;It's working! Thank you so much! Where have you learned to build up those SED/RegEx commands? &lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2017 10:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-JSON-file-into-separate-events-removing-the-header-and/m-p/345085#M102235</guid>
      <dc:creator>mblauw</dc:creator>
      <dc:date>2017-03-11T10:23:15Z</dc:date>
    </item>
  </channel>
</rss>

