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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...