<?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 Break individual events from json array in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479678#M134446</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have been working on breaking events which come from the Splunk Rest api addon output. Default "_json" source_type is considering the entire api response as a single event. My aim is to get individual events for objects come under "results". I have tested some custom source types using props.conf but none of them seems working. Please help me with the props.conf entries.&lt;/P&gt;

&lt;P&gt;Required individual event example. NB : The fields in the event is dynamic&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
    "created" : "2020-02-27T06:14:34Z",&lt;BR /&gt;
    "eventTypeName" : "EVENT1",&lt;BR /&gt;
    "groupId" : "xxx",&lt;BR /&gt;
    "id" : "xxx",&lt;BR /&gt;
    "isGlobalAdmin" : false,&lt;BR /&gt;
    "links" : [ {&lt;BR /&gt;
      "href" : "&lt;A href="https://example.com/api/v2" target="_blank"&gt;https://example.com/api/v2&lt;/A&gt;",&lt;BR /&gt;
      "rel" : "self"&lt;BR /&gt;
    } ]&lt;BR /&gt;
  }&lt;/P&gt;

&lt;P&gt;I am pasting the entire API response below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Code below :
{
  "links" : [ {
    "href" : "https://example.com/api/v2",
    "rel" : "self"
  } ],
  "results" : [ {
"created" : "2020-02-27T06:14:34Z",
"eventTypeName" : "EVENT1",
"groupId" : "xxxxx",
"id" : "xxxx",
"isGlobalAdmin" : false,
"links" : [ {
  "href" : "https://example.com/api/v2",
  "rel" : "self"
} ]
}, {
"clusterName" : "splunk-cluster",
"created" : "2020-02-27T06:14:33Z",
"eventTypeName" : "EVENT2",
"groupId" : "xxxxx",
"id" : "xxxxx",
"isGlobalAdmin" : false,
"links" : [ {
  "href" : "https://example.com/api/v2",
  "rel" : "self"
 } ]
}, {
"created" : "2020-02-27T06:14:32Z",
"eventTypeName" : "EVENT3",
"groupId" : "xxxxxx",
"id" : "xxxxxx",
"isGlobalAdmin" : false,
"links" : [ {
  "href" : "https://example.com/api/v2",
  "rel" : "self"
} ],
"remoteAddress" : "xx.xx.xx.xx",
"userId" : "xxxxxx",
"username" : "Sam-test"
} ],
"totalCount" : 3
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:21:42 GMT</pubDate>
    <dc:creator>dvarghes</dc:creator>
    <dc:date>2020-09-30T04:21:42Z</dc:date>
    <item>
      <title>Break individual events from json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479678#M134446</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have been working on breaking events which come from the Splunk Rest api addon output. Default "_json" source_type is considering the entire api response as a single event. My aim is to get individual events for objects come under "results". I have tested some custom source types using props.conf but none of them seems working. Please help me with the props.conf entries.&lt;/P&gt;

&lt;P&gt;Required individual event example. NB : The fields in the event is dynamic&lt;/P&gt;

&lt;P&gt;{&lt;BR /&gt;
    "created" : "2020-02-27T06:14:34Z",&lt;BR /&gt;
    "eventTypeName" : "EVENT1",&lt;BR /&gt;
    "groupId" : "xxx",&lt;BR /&gt;
    "id" : "xxx",&lt;BR /&gt;
    "isGlobalAdmin" : false,&lt;BR /&gt;
    "links" : [ {&lt;BR /&gt;
      "href" : "&lt;A href="https://example.com/api/v2" target="_blank"&gt;https://example.com/api/v2&lt;/A&gt;",&lt;BR /&gt;
      "rel" : "self"&lt;BR /&gt;
    } ]&lt;BR /&gt;
  }&lt;/P&gt;

&lt;P&gt;I am pasting the entire API response below :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Code below :
{
  "links" : [ {
    "href" : "https://example.com/api/v2",
    "rel" : "self"
  } ],
  "results" : [ {
"created" : "2020-02-27T06:14:34Z",
"eventTypeName" : "EVENT1",
"groupId" : "xxxxx",
"id" : "xxxx",
"isGlobalAdmin" : false,
"links" : [ {
  "href" : "https://example.com/api/v2",
  "rel" : "self"
} ]
}, {
"clusterName" : "splunk-cluster",
"created" : "2020-02-27T06:14:33Z",
"eventTypeName" : "EVENT2",
"groupId" : "xxxxx",
"id" : "xxxxx",
"isGlobalAdmin" : false,
"links" : [ {
  "href" : "https://example.com/api/v2",
  "rel" : "self"
 } ]
}, {
"created" : "2020-02-27T06:14:32Z",
"eventTypeName" : "EVENT3",
"groupId" : "xxxxxx",
"id" : "xxxxxx",
"isGlobalAdmin" : false,
"links" : [ {
  "href" : "https://example.com/api/v2",
  "rel" : "self"
} ],
"remoteAddress" : "xx.xx.xx.xx",
"userId" : "xxxxxx",
"username" : "Sam-test"
} ],
"totalCount" : 3
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:21:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479678#M134446</guid>
      <dc:creator>dvarghes</dc:creator>
      <dc:date>2020-09-30T04:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Break individual events from json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479679#M134447</link>
      <description>&lt;P&gt;The following line breaker is not working :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(\},)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 06:53:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479679#M134447</guid>
      <dc:creator>dvarghes</dc:creator>
      <dc:date>2020-02-27T06:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Break individual events from json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479680#M134448</link>
      <description>&lt;P&gt;I have tried this in props conf, but not working : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; # props.conf
 [xxxxxxx]
 BREAK_ONLY_BEFORE_DATE = false
 BREAK_ONLY_BEFORE = (\{|\[\s+{)
 MUST_BREAK_AFTER = (\}|\}\s+\])
 SEDCMD-remove_header = s/(\{\s+.+?\[)//g
 SEDCMD-remove_trailing_commas = s/\},/}/g
 SEDCMD-remove_footer = s/\]\s+\}//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 10:03:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479680#M134448</guid>
      <dc:creator>dvarghes</dc:creator>
      <dc:date>2020-02-27T10:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Break individual events from json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479681#M134449</link>
      <description>&lt;P&gt;KV_MODE=JSON&lt;BR /&gt;
only.&lt;BR /&gt;
OR&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/802709/make-extractions-in-propsconf-from-search-query.html"&gt;https://answers.splunk.com/answers/802709/make-extractions-in-propsconf-from-search-query.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 21:50:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479681#M134449</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-27T21:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Break individual events from json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479682#M134450</link>
      <description>&lt;P&gt;This did not work. All the API response is being considered as a single event.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 08:42:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479682#M134450</guid>
      <dc:creator>dvarghes</dc:creator>
      <dc:date>2020-02-28T08:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Break individual events from json array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479683#M134451</link>
      <description>&lt;P&gt;&lt;CODE&gt;spath&lt;/CODE&gt;can be used single event.&lt;BR /&gt;
my Q's solution needs LINE_BREAKER&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"links\":[{\"href\":\"https://example.com/api/v2\",\"rel\":\"self\"}],\"results\":[{\"created\":\"2020-02-27T06:14:34Z\",\"eventTypeName\":\"EVENT1\",\"groupId\":\"xxxxx\",\"id\":\"xxxx\",\"isGlobalAdmin\":false,\"links\":[{\"href\":\"https://example.com/api/v2\",\"rel\":\"self\"}]},{\"clusterName\":\"splunk-cluster\",\"created\":\"2020-02-27T06:14:33Z\",\"eventTypeName\":\"EVENT2\",\"groupId\":\"xxxxx\",\"id\":\"xxxxx\",\"isGlobalAdmin\":false,\"links\":[{\"href\":\"https://example.com/api/v2\",\"rel\":\"self\"}]},{\"created\":\"2020-02-27T06:14:32Z\",\"eventTypeName\":\"EVENT3\",\"groupId\":\"xxxxxx\",\"id\":\"xxxxxx\",\"isGlobalAdmin\":false,\"links\":[{\"href\":\"https://example.com/api/v2\",\"rel\":\"self\"}],\"remoteAddress\":\"xx.xx.xx.xx\",\"userId\":\"xxxxxx\",\"username\":\"Sam-test\"}],\"totalCount\":3}"
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;your JSON is valid JSON. &lt;CODE&gt;KV_MODE=JSON&lt;/CODE&gt; will run.&lt;BR /&gt;
maybe, your &lt;EM&gt;props.conf&lt;/EM&gt;  has extra line breakers, so it's not work.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 09:00:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Break-individual-events-from-json-array/m-p/479683#M134451</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-28T09:00:32Z</dc:date>
    </item>
  </channel>
</rss>

