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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...