<?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 Count events which has defined a path in JSON in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Count-events-which-has-defined-a-path-in-JSON/m-p/393413#M70246</link>
    <description>&lt;P&gt;Hello there,&lt;/P&gt;

&lt;P&gt;I have the next JSON which would be my event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"severity":"PROCESS","marker":"EML[ EMLMOD ]","logger":"SURALOGGER[PROCESS#EML#EMLMOD]","thread":"application-akka.actor.default-dispatcher-8","message":"TRANSACTIONID=dec-cf08c726-c229-46ed-9c4a-2a19b760f1c8|FECCOL=2019-04-08T14:00:07|COMENTARIO=null|DECLARACION={\"idDeclaracion\":\"dec-cf08c726-c229-46ed-9c4a-2a19b760f1c8\",\"idCotizacion\":\"cot004\",\"idSolicitud\":\"080008072325\",\"fecha\":1554317807,\"producto\":{\"ramo\":\"080\",\"subRamo\":\"vc2\"},\"canal\":\"020\",\"prospecto\":{\"id\":\"1111\",\"edad\":29,\"talla\":180,\"peso\":80,\"imc\":24.69,\"ocupacion\":\"A36\",\"sexo\":\"femenino\"},\"datosAdicionales\":null,\"preguntas\":[{\"id\":\"pe-38104e2d-28d0-49d1-ab80-37f8537cd3bc\",\"respuestas\":[{\"id\":\"re-3a8ba35c-e3d7-4eea-8d80-167ec5c213ea\",\"esPositiva\":false}]},{\"id\":\"pe-c67edfb6-f990-4bc4-ba9f-f6a2dca8b914\",\"respuestas\":[{\"id\":\"re-a315d1ab-f57f-41d0-96c3-ee4048504d5e\",\"esPositiva\":true},{\"id\":\"re-8251a993-595a-4f69-883b-fccf01748518\",\"esPositiva\":true}]},{\"id\":\"pe-9945cdf8-eb3d-4499-887b-40fe201e2c64\",\"respuestas\":[{\"id\":\"re-negativa-pregunta-otras-enfermedades\",\"esPositiva\":false}]},{\"id\":\"pe-19f3325e-f775-4abe-a8e1-218d1bb24cc6\",\"respuestas\":[{\"id\":\"re-negativa-pregunta-otros-deportes\",\"esPositiva\":false}]},{\"id\":\"pe-d0bdf8cd-bb79-4440-b171-0028ca1deb3a\",\"respuestas\":[{\"id\":\"re-1bb16e02-ec0a-4b36-8f5d-4cff953a70ae\",\"esPositiva\":false}]},{\"id\":\"pe-35d09af1-4ad4-46e9-bd76-e50f2afa5dcc\",\"respuestas\":[{\"id\":\"re-9e559f45-342c-4f7c-9a4d-1bf0daebaa5d\",\"esPositiva\":false}]},{\"id\":\"pe-3705c84b-2e55-4bb0-9c3c-1061b7814e8d\",\"respuestas\":[{\"id\":\"re-b4add8ef-ccae-49c3-a664-242bfa4a6875\",\"esPositiva\":true}]},{\"id\":\"pe-3b93e80e-d7d0-4d90-bf13-16489da2d47f\",\"respuestas\":[{\"id\":\"re-95f212a4-3562-405a-be24-aa656b93fe80\",\"esPositiva\":false}]}],\"decisiones\":{\"declinar\":{\"coberturas\":[\"vrd\",\"pau\",\"vgc\"],\"codigosCie\":[]},\"aprobar\":{\"coberturas\":[\"gex\",\"vcn\"],\"codigosCie\":[]},\"extraprimar-miles\":[{\"cobertura\":\"mac\",\"magnitud\":3,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]},{\"cobertura\":\"vid\",\"magnitud\":3,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]}],\"extraprimar-porcentaje\":[{\"cobertura\":\"ive\",\"magnitud\":25,\"clasificacion\":\"morbilidad\",\"codigosCie\":[\"I10X\"]},{\"cobertura\":\"ive\",\"magnitud\":100,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]},{\"cobertura\":\"vid\",\"magnitud\":25,\"clasificacion\":\"morbilidad\",\"codigosCie\":[\"I10X\"]},{\"cobertura\":\"iva\",\"magnitud\":100,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]},{\"cobertura\":\"efg\",\"magnitud\":25,\"clasificacion\":\"morbilidad\",\"codigosCie\":[\"I10X\"]},{\"cobertura\":\"efg\",\"magnitud\":50,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]}],\"riesgo-sub-normal\":[\"E780\",\"I10X\"]}}"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to count the events which has the path 'decisiones.declinar' defined.&lt;/P&gt;

&lt;P&gt;This is my query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=eml | rex field=message "DECLARACION=(?&amp;lt;declaracion&amp;gt;[\"\s\W\{\}\[\]:\w\n\.]+)" | where NOT isnull(declaracion) | spath input=declaracion | eval declinar = if(isnull('decisiones.declinar'), 0, 1) | table declinar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is i always get 0 for each event, even though the path 'decisiones.declinar' is defined.&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2019 21:35:34 GMT</pubDate>
    <dc:creator>ivykp</dc:creator>
    <dc:date>2019-04-08T21:35:34Z</dc:date>
    <item>
      <title>Count events which has defined a path in JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Count-events-which-has-defined-a-path-in-JSON/m-p/393413#M70246</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;

&lt;P&gt;I have the next JSON which would be my event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"severity":"PROCESS","marker":"EML[ EMLMOD ]","logger":"SURALOGGER[PROCESS#EML#EMLMOD]","thread":"application-akka.actor.default-dispatcher-8","message":"TRANSACTIONID=dec-cf08c726-c229-46ed-9c4a-2a19b760f1c8|FECCOL=2019-04-08T14:00:07|COMENTARIO=null|DECLARACION={\"idDeclaracion\":\"dec-cf08c726-c229-46ed-9c4a-2a19b760f1c8\",\"idCotizacion\":\"cot004\",\"idSolicitud\":\"080008072325\",\"fecha\":1554317807,\"producto\":{\"ramo\":\"080\",\"subRamo\":\"vc2\"},\"canal\":\"020\",\"prospecto\":{\"id\":\"1111\",\"edad\":29,\"talla\":180,\"peso\":80,\"imc\":24.69,\"ocupacion\":\"A36\",\"sexo\":\"femenino\"},\"datosAdicionales\":null,\"preguntas\":[{\"id\":\"pe-38104e2d-28d0-49d1-ab80-37f8537cd3bc\",\"respuestas\":[{\"id\":\"re-3a8ba35c-e3d7-4eea-8d80-167ec5c213ea\",\"esPositiva\":false}]},{\"id\":\"pe-c67edfb6-f990-4bc4-ba9f-f6a2dca8b914\",\"respuestas\":[{\"id\":\"re-a315d1ab-f57f-41d0-96c3-ee4048504d5e\",\"esPositiva\":true},{\"id\":\"re-8251a993-595a-4f69-883b-fccf01748518\",\"esPositiva\":true}]},{\"id\":\"pe-9945cdf8-eb3d-4499-887b-40fe201e2c64\",\"respuestas\":[{\"id\":\"re-negativa-pregunta-otras-enfermedades\",\"esPositiva\":false}]},{\"id\":\"pe-19f3325e-f775-4abe-a8e1-218d1bb24cc6\",\"respuestas\":[{\"id\":\"re-negativa-pregunta-otros-deportes\",\"esPositiva\":false}]},{\"id\":\"pe-d0bdf8cd-bb79-4440-b171-0028ca1deb3a\",\"respuestas\":[{\"id\":\"re-1bb16e02-ec0a-4b36-8f5d-4cff953a70ae\",\"esPositiva\":false}]},{\"id\":\"pe-35d09af1-4ad4-46e9-bd76-e50f2afa5dcc\",\"respuestas\":[{\"id\":\"re-9e559f45-342c-4f7c-9a4d-1bf0daebaa5d\",\"esPositiva\":false}]},{\"id\":\"pe-3705c84b-2e55-4bb0-9c3c-1061b7814e8d\",\"respuestas\":[{\"id\":\"re-b4add8ef-ccae-49c3-a664-242bfa4a6875\",\"esPositiva\":true}]},{\"id\":\"pe-3b93e80e-d7d0-4d90-bf13-16489da2d47f\",\"respuestas\":[{\"id\":\"re-95f212a4-3562-405a-be24-aa656b93fe80\",\"esPositiva\":false}]}],\"decisiones\":{\"declinar\":{\"coberturas\":[\"vrd\",\"pau\",\"vgc\"],\"codigosCie\":[]},\"aprobar\":{\"coberturas\":[\"gex\",\"vcn\"],\"codigosCie\":[]},\"extraprimar-miles\":[{\"cobertura\":\"mac\",\"magnitud\":3,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]},{\"cobertura\":\"vid\",\"magnitud\":3,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]}],\"extraprimar-porcentaje\":[{\"cobertura\":\"ive\",\"magnitud\":25,\"clasificacion\":\"morbilidad\",\"codigosCie\":[\"I10X\"]},{\"cobertura\":\"ive\",\"magnitud\":100,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]},{\"cobertura\":\"vid\",\"magnitud\":25,\"clasificacion\":\"morbilidad\",\"codigosCie\":[\"I10X\"]},{\"cobertura\":\"iva\",\"magnitud\":100,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]},{\"cobertura\":\"efg\",\"magnitud\":25,\"clasificacion\":\"morbilidad\",\"codigosCie\":[\"I10X\"]},{\"cobertura\":\"efg\",\"magnitud\":50,\"clasificacion\":\"deporte extremo\",\"codigosCie\":[\"Z57\"]}],\"riesgo-sub-normal\":[\"E780\",\"I10X\"]}}"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to count the events which has the path 'decisiones.declinar' defined.&lt;/P&gt;

&lt;P&gt;This is my query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=eml | rex field=message "DECLARACION=(?&amp;lt;declaracion&amp;gt;[\"\s\W\{\}\[\]:\w\n\.]+)" | where NOT isnull(declaracion) | spath input=declaracion | eval declinar = if(isnull('decisiones.declinar'), 0, 1) | table declinar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is i always get 0 for each event, even though the path 'decisiones.declinar' is defined.&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 21:35:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Count-events-which-has-defined-a-path-in-JSON/m-p/393413#M70246</guid>
      <dc:creator>ivykp</dc:creator>
      <dc:date>2019-04-08T21:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count events which has defined a path in JSON</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Count-events-which-has-defined-a-path-in-JSON/m-p/393414#M70247</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Give a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=eml 
| rex field=message "DECLARACION=(?&amp;lt;declaracion&amp;gt;[\"\s\W\{\}\[\]:\w\n\.]+)" 
| where NOT isnull(declaracion) 
| spath input=declaracion 
| eval declinar = if(isnull('decisiones.declinar.coberturas{}'), 0, 1) 
| table declinar,decisiones.declinar.coberturas{}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2019 06:54:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Count-events-which-has-defined-a-path-in-JSON/m-p/393414#M70247</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-04-09T06:54:33Z</dc:date>
    </item>
  </channel>
</rss>

