Splunk Search

How do I break multiple events by Regex into single event objects

BrandSentiment
Explorer

I would like to break this into individual events before the ",{type" :

{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [34.7500, 31.5000] }, "properties": {  "urlpubtimedate": "2015-11-08T16:30:00Z", "name": "Israel", "geores": 1, "url": "http://www.bbc.co.uk/news/world-us-canada-34729243", "urldomain": "bbc.co.uk", "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg", "urllangcode": "eng", "urltone": 0.88, "urlwordcnt": 752, "urlnumamounts": 2, "mentionedthemes": ";APPOINTMENT;TAX_POLITICAL_PARTY_REPUBLICANS;GENERAL_GOVERNMENT;MANMADE_DISASTER_IMPLIED;TAX_FNCACT_LEADERS;USPEC_POLITICS_GENERAL1;TAX_ETHNICITY_AMERICAN;SLFID_MILITARY_SPENDING;WB_2471_PEACEKEEPING;USPEC_POLICY1;TAX_FNCACT_MINISTER;TAX_FNCACT_CHILD;NEGOTIATIONS;TAX_POLITICAL_PARTY_DEMOCRATS;MEDIA_SOCIAL;", "mentionednames": ";Israel National Public Diplomacy Directorate;Benjamin Netayahu;Facebook;"} },{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-77.0364, 38.8951] }, "properties": {  "urlpubtimedate": "2015-11-08T16:30:00Z", "name": "Washington, District Of Columbia, United States", "geores": 3, "url": "http://www.bbc.co.uk/news/world-us-canada-34729243", "urldomain": "bbc.co.uk", "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg", "urllangcode": "eng", "urltone": 0.88, "urlwordcnt": 752, "urlnumamounts": 2, "mentionedthemes": ";TAX_FNCACT_MINISTER;TAX_FNCACT_MAN;GENERAL_GOVERNMENT;CRISISLEX_C07_SAFETY;USPEC_POLITICS_GENERAL1;TAX_FNCACT_OFFICIAL;", "mentionednames": ";White House;Benjamin Netanyahu;Us Congress;"} },{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [51.5148, 35.7500] }, "properties": {  "urlpubtimedate": "2015-11-08T16:30:00Z", "name": "Tehran, Tehran, Iran", "geores": 3, "url": "http://www.bbc.co.uk/news/world-us-canada-34729243", "urldomain": "bbc.co.uk", "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg", "urllangcode": "eng", "urltone": 0.88, "urlwordcnt": 752, "urlnumamounts": 2, "mentionedthemes": ";WMD;", "mentionednames": ""} },{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [37.6156, 55.7522] }, "properties": {  "urlpubtimedate": "2015-11-08T16:30:00Z", "name": "Moscow, Moskva, Russia", "geores": 3, "url": "http://www.bbc.co.uk/news/world-us-canada-34729243", "urldomain": "bbc.co.uk", "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg", "urllangcode": "eng", "urltone": 0.88, "urlwordcnt": 752, "urlnumamounts": 2, "mentionedthemes": ";TAX_FNCACT_MINISTER;", "mentionednames": ""} },{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [38.0000, 35.0000] }, "properties": {  "urlpubtimedate": "2015-11-08T16:30:00Z", "name": "Syria", "geores": 1, "url": "http://www.bbc.co.uk/news/world-us-canada-34729243", "urldomain": "bbc.co.uk", "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg", "urllangcode": "eng", "urltone": 0.88, "urlwordcnt": 752, "urlnumamounts": 2, "mentionedthemes": ";USPEC_POLITICS_GENERAL1;", "mentionednames": ""} },{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [53.0000, 32.0000] }, "properties": {  "urlpubtimedate": "2015-11-08T16:30:00Z", "name": "Iran", "geores": 1, "url": "http://www.bbc.co.uk/news/world-us-canada-34729243", "urldomain": "bbc.co.uk", "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg", "urllangcode": "eng", "urltone": 0.88, "urlwordcnt": 752, "urlnumamounts": 2, "mentionedthemes": ";TAX_ETHNICITY_AMERICANS;NEGOTIATIONS;WB_724_HUMAN_RESOURCES_FOR_PUBLIC_SECTOR;", "mentionednames": ";White House;"} }] } 

So it looks like:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          34.75,
          31.5
        ]
      },
      "properties": {
        "urlpubtimedate": "2015-11-08T16:30:00Z",
        "name": "Israel",
        "geores": 1,
        "url": "http://www.bbc.co.uk/news/world-us-canada-34729243",
        "urldomain": "bbc.co.uk",
        "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg",
        "urllangcode": "eng",
        "urltone": 0.88,
        "urlwordcnt": 752,
        "urlnumamounts": 2,
        "mentionedthemes": ";APPOINTMENT;TAX_POLITICAL_PARTY_REPUBLICANS;GENERAL_GOVERNMENT;MANMADE_DISASTER_IMPLIED;TAX_FNCACT_LEADERS;USPEC_POLITICS_GENERAL1;TAX_ETHNICITY_AMERICAN;SLFID_MILITARY_SPENDING;WB_2471_PEACEKEEPING;USPEC_POLICY1;TAX_FNCACT_MINISTER;TAX_FNCACT_CHILD;NEGOTIATIONS;TAX_POLITICAL_PARTY_DEMOCRATS;MEDIA_SOCIAL;",
        "mentionednames": ";Israel National Public Diplomacy Directorate;Benjamin Netayahu;Facebook;"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -77.0364,
          38.8951
        ]
      },
      "properties": {
        "urlpubtimedate": "2015-11-08T16:30:00Z",
        "name": "Washington, District Of Columbia, United States",
        "geores": 3,
        "url": "http://www.bbc.co.uk/news/world-us-canada-34729243",
        "urldomain": "bbc.co.uk",
        "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg",
        "urllangcode": "eng",
        "urltone": 0.88,
        "urlwordcnt": 752,
        "urlnumamounts": 2,
        "mentionedthemes": ";TAX_FNCACT_MINISTER;TAX_FNCACT_MAN;GENERAL_GOVERNMENT;CRISISLEX_C07_SAFETY;USPEC_POLITICS_GENERAL1;TAX_FNCACT_OFFICIAL;",
        "mentionednames": ";White House;Benjamin Netanyahu;Us Congress;"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          51.5148,
          35.75
        ]
      },
      "properties": {
        "urlpubtimedate": "2015-11-08T16:30:00Z",
        "name": "Tehran, Tehran, Iran",
        "geores": 3,
        "url": "http://www.bbc.co.uk/news/world-us-canada-34729243",
        "urldomain": "bbc.co.uk",
        "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg",
        "urllangcode": "eng",
        "urltone": 0.88,
        "urlwordcnt": 752,
        "urlnumamounts": 2,
        "mentionedthemes": ";WMD;",
        "mentionednames": ""
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          37.6156,
          55.7522
        ]
      },
      "properties": {
        "urlpubtimedate": "2015-11-08T16:30:00Z",
        "name": "Moscow, Moskva, Russia",
        "geores": 3,
        "url": "http://www.bbc.co.uk/news/world-us-canada-34729243",
        "urldomain": "bbc.co.uk",
        "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg",
        "urllangcode": "eng",
        "urltone": 0.88,
        "urlwordcnt": 752,
        "urlnumamounts": 2,
        "mentionedthemes": ";TAX_FNCACT_MINISTER;",
        "mentionednames": ""
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          38,
          35
        ]
      },
      "properties": {
        "urlpubtimedate": "2015-11-08T16:30:00Z",
        "name": "Syria",
        "geores": 1,
        "url": "http://www.bbc.co.uk/news/world-us-canada-34729243",
        "urldomain": "bbc.co.uk",
        "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg",
        "urllangcode": "eng",
        "urltone": 0.88,
        "urlwordcnt": 752,
        "urlnumamounts": 2,
        "mentionedthemes": ";USPEC_POLITICS_GENERAL1;",
        "mentionednames": ""
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          53,
          32
        ]
      },
      "properties": {
        "urlpubtimedate": "2015-11-08T16:30:00Z",
        "name": "Iran",
        "geores": 1,
        "url": "http://www.bbc.co.uk/news/world-us-canada-34729243",
        "urldomain": "bbc.co.uk",
        "urlsocialimage": "http://ichef-1.bbci.co.uk/news/1024/cpsprodpb/15BB8/production/_86561098_gettyimages-456461420.jpg",
        "urllangcode": "eng",
        "urltone": 0.88,
        "urlwordcnt": 752,
        "urlnumamounts": 2,
        "mentionedthemes": ";TAX_ETHNICITY_AMERICANS;NEGOTIATIONS;WB_724_HUMAN_RESOURCES_FOR_PUBLIC_SECTOR;",
        "mentionednames": ";White House;"
      }
    }
  ]
}

Do I need to use SHOULD_LINEMERGE ?

Thanks

0 Karma

Richfez
SplunkTrust
SplunkTrust

That validates as JSON. It could perhaps be more useful to you if you were switch the input to JSON to take advantage of those features. You may still have some cleaning up to do, but I think it'll get you a lot closer to having usable data.

Please see this excellent and short answer by martin_mueller for more information, and be sure to upvote that answer if you find it useful.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...