<?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: Is it possible to transform JSON events to be independent, then store them in another index? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401497#M71479</link>
    <description>&lt;P&gt;@splunksumman &lt;/P&gt;

&lt;P&gt;Can you please below search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH | rex field=_raw "\"task\":\s{(?&amp;lt;task&amp;gt;.*)}}$" 
| rex max_match=0 mode=sed field=task "s/\"},\"/\"}|\"/g" 
| eval task=split(task,"|") 
| mvexpand task 
| eval _raw=task 
| table _raw | rex field=_raw "\"(?&amp;lt;PArea&amp;gt;.*)\":\s\{\"FechaAsignacion\":\s\"(?&amp;lt;FechaAsignacion&amp;gt;.*)\",\"FechaGestion\":\s\"(?&amp;lt;FechaGestion&amp;gt;.*)\",\"UsuarioGestion\":\s\"(?&amp;lt;UsuarioGestion&amp;gt;.*)\",\"Observacion\":\s\"(?&amp;lt;Observacion&amp;gt;.*)\"\}" | table  PArea FechaAsignacion FechaGestion UsuarioGestion Observacion
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Sample Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"NoTramite\": \"123456\",\"task\": {\"A\": {\"FechaAsignacion\": \"01-10-2018\",\"FechaGestion\": \"23-10-2018\",\"UsuarioGestion\": \"PEDRO\",\"Observacion\": \"\"},\"B\": {\"FechaAsignacion\": \"01-11-2018\",\"FechaGestion\": \"01-11-2018\",\"UsuarioGestion\": \"CARLOS\",\"Observacion\": \"\"},\"C\": {\"FechaAsignacion\": \"01-12-2018\",\"FechaGestion\": \"10-12-2018\",\"UsuarioGestion\": \"MARIO\",\"Observacion\": \"\"},\"D\": {\"FechaAsignacion\": \"01-12-2018\",\"FechaGestion\": \"10-12-2018\",\"UsuarioGestion\": \"MARIO1\",\"Observacion\": \"\"}}}" 
| rex field=_raw "\"task\":\s{(?&amp;lt;task&amp;gt;.*)}}$" 
| rex max_match=0 mode=sed field=task "s/\"},\"/\"}|\"/g" 
| eval task=split(task,"|") 
| mvexpand task 
| eval _raw=task 
| table _raw | rex field=_raw "\"(?&amp;lt;PArea&amp;gt;.*)\":\s\{\"FechaAsignacion\":\s\"(?&amp;lt;FechaAsignacion&amp;gt;.*)\",\"FechaGestion\":\s\"(?&amp;lt;FechaGestion&amp;gt;.*)\",\"UsuarioGestion\":\s\"(?&amp;lt;UsuarioGestion&amp;gt;.*)\",\"Observacion\":\s\"(?&amp;lt;Observacion&amp;gt;.*)\"\}" | table  PArea FechaAsignacion FechaGestion UsuarioGestion Observacion
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Note: The regex might require changes in case of variation of JSON pattern.&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2019 11:05:54 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2019-06-07T11:05:54Z</dc:date>
    <item>
      <title>Is it possible to transform JSON events to be independent, then store them in another index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401494#M71476</link>
      <description>&lt;P&gt;Hello community, once again, I need your help.&lt;/P&gt;

&lt;P&gt;I have a training source in json format in which transactions with 50 different tasks are registered, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
  "NoTramite": "123456",
  "task": {
    "A": {
      "FechaAsignacion": "01-10-2018",
      "FechaGestion": "23-10-2018",
      "UsuarioGestion": "PEDRO",
      "Observacion": ""
    },
    "B": {
      "FechaAsignacion": "01-11-2018",
      "FechaGestion": "01-11-2018",
      "UsuarioGestion": "CARLOS",
      "Observacion": ""
    },
    "C": {
      "FechaAsignacion": "01-12-2018",
      "FechaGestion": "10-12-2018",
      "UsuarioGestion": "MARIO",
      "Observacion": ""
    }
  }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;each event of a transaction has tasks A, B, C ... n up to 50 tasks&lt;/P&gt;

&lt;P&gt;indexing them in Splunk the name of the field is like this:&lt;BR /&gt;
task.A.DateAsignation&lt;BR /&gt;
task.A.FechaGestion&lt;BR /&gt;
task.A.UsuarioGestion&lt;BR /&gt;
task.A.Observation&lt;BR /&gt;
task.B.FechaAsignacion&lt;BR /&gt;
task.B.FechaGestion&lt;BR /&gt;
task.B.UsuarioGestion&lt;BR /&gt;
task.B.Observation&lt;/P&gt;

&lt;P&gt;I know that the ideal is to have an event for each task assigned to the number of the transaction.&lt;/P&gt;

&lt;P&gt;Is it possible to transform these events to be independent and then store them in another index?&lt;/P&gt;

&lt;P&gt;What would be the best recommendation to handle this type of event?&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 20:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401494#M71476</guid>
      <dc:creator>splunksumman</dc:creator>
      <dc:date>2019-05-31T20:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to transform JSON events to be independent, then store them in another index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401495#M71477</link>
      <description>&lt;P&gt;Hey, I have found a similar issue with a proper answer&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/376095/how-can-i-split-a-json-array-in-mutiple-events.html"&gt;https://answers.splunk.com/answers/376095/how-can-i-split-a-json-array-in-mutiple-events.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2019 11:36:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401495#M71477</guid>
      <dc:creator>siddharthkhatsu</dc:creator>
      <dc:date>2019-06-01T11:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to transform JSON events to be independent, then store them in another index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401496#M71478</link>
      <description>&lt;P&gt;Hi @siddharthkhatsuriya thank for you answer,&lt;/P&gt;

&lt;P&gt;Is it possible how are the names of the fields to build a dataset similar to this example?&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7138iB8AE3CD0CE29B803/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What I'm looking for is being able to answer questions like:&lt;/P&gt;

&lt;P&gt;Top of tasks&lt;BR /&gt;
duration of tasks&lt;BR /&gt;
etc..&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2019 15:47:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401496#M71478</guid>
      <dc:creator>splunksumman</dc:creator>
      <dc:date>2019-06-01T15:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to transform JSON events to be independent, then store them in another index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401497#M71479</link>
      <description>&lt;P&gt;@splunksumman &lt;/P&gt;

&lt;P&gt;Can you please below search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH | rex field=_raw "\"task\":\s{(?&amp;lt;task&amp;gt;.*)}}$" 
| rex max_match=0 mode=sed field=task "s/\"},\"/\"}|\"/g" 
| eval task=split(task,"|") 
| mvexpand task 
| eval _raw=task 
| table _raw | rex field=_raw "\"(?&amp;lt;PArea&amp;gt;.*)\":\s\{\"FechaAsignacion\":\s\"(?&amp;lt;FechaAsignacion&amp;gt;.*)\",\"FechaGestion\":\s\"(?&amp;lt;FechaGestion&amp;gt;.*)\",\"UsuarioGestion\":\s\"(?&amp;lt;UsuarioGestion&amp;gt;.*)\",\"Observacion\":\s\"(?&amp;lt;Observacion&amp;gt;.*)\"\}" | table  PArea FechaAsignacion FechaGestion UsuarioGestion Observacion
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Sample Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{\"NoTramite\": \"123456\",\"task\": {\"A\": {\"FechaAsignacion\": \"01-10-2018\",\"FechaGestion\": \"23-10-2018\",\"UsuarioGestion\": \"PEDRO\",\"Observacion\": \"\"},\"B\": {\"FechaAsignacion\": \"01-11-2018\",\"FechaGestion\": \"01-11-2018\",\"UsuarioGestion\": \"CARLOS\",\"Observacion\": \"\"},\"C\": {\"FechaAsignacion\": \"01-12-2018\",\"FechaGestion\": \"10-12-2018\",\"UsuarioGestion\": \"MARIO\",\"Observacion\": \"\"},\"D\": {\"FechaAsignacion\": \"01-12-2018\",\"FechaGestion\": \"10-12-2018\",\"UsuarioGestion\": \"MARIO1\",\"Observacion\": \"\"}}}" 
| rex field=_raw "\"task\":\s{(?&amp;lt;task&amp;gt;.*)}}$" 
| rex max_match=0 mode=sed field=task "s/\"},\"/\"}|\"/g" 
| eval task=split(task,"|") 
| mvexpand task 
| eval _raw=task 
| table _raw | rex field=_raw "\"(?&amp;lt;PArea&amp;gt;.*)\":\s\{\"FechaAsignacion\":\s\"(?&amp;lt;FechaAsignacion&amp;gt;.*)\",\"FechaGestion\":\s\"(?&amp;lt;FechaGestion&amp;gt;.*)\",\"UsuarioGestion\":\s\"(?&amp;lt;UsuarioGestion&amp;gt;.*)\",\"Observacion\":\s\"(?&amp;lt;Observacion&amp;gt;.*)\"\}" | table  PArea FechaAsignacion FechaGestion UsuarioGestion Observacion
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Note: The regex might require changes in case of variation of JSON pattern.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 11:05:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-transform-JSON-events-to-be-independent-then/m-p/401497#M71479</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-06-07T11:05:54Z</dc:date>
    </item>
  </channel>
</rss>

