<?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: How to achieve Crowdsec json logs fields extraction? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-Crowdsec-json-logs-fields-extraction/m-p/629277#M218586</link>
    <description>&lt;P&gt;Hi ! Shivam from CrowdSec here. Although I'm not very familiar with Splunk, you can simplify the JSON pushed by CrowdSec to Splunk. This would make your data extraction logic simpler too.&lt;/P&gt;&lt;P&gt;To do this you'd need to override the "format" parameter at "&lt;SPAN&gt;/etc/crowdsec/notifications/splunk.yaml" . The "format" parameter is gotemplate which receives an &lt;A href="https://docs.crowdsec.net/docs/notification_plugins/intro#alert-object" target="_self"&gt;alert object&lt;/A&gt;&amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let us know if you need help here or on our &lt;A href="https://discord.gg/crowdsec" target="_self"&gt;discord&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 06:59:54 GMT</pubDate>
    <dc:creator>sbs2001</dc:creator>
    <dc:date>2023-02-02T06:59:54Z</dc:date>
    <item>
      <title>How to achieve Crowdsec json logs fields extraction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-Crowdsec-json-logs-fields-extraction/m-p/629154#M218543</link>
      <description>&lt;P&gt;&lt;EM&gt;Hello Splunk's community,&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I got some difficulty for the fields extraction in crowdsec's logs which are format with JSON (using the crowdsec plugin dedicated to this task). I know that there is a lot of post on this forum about json fields extraction but i didn't find any case that could helped me on this.&lt;/P&gt;
&lt;P&gt;Firstly here is a sample of an events:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;	
{ [-]
   capacity: 40
   decisions: [ [-]
     { [-]
       duration: 4h
       origin: crowdsec
       scenario: crowdsecurity/http-crawl-non_statics
       scope: Ip
       type: ban
       value: confidential
     }
   ]
   events: [ [-]
     { [-]
       meta: [ [-]
         { [+]
         }
         { [+]
         }
         { [-]
           key: IsInEU
           value: true
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
         { [+]
         }
       ]
       timestamp: 2023-02-01T15:22:29+01:00
     }
     { [+]
     }
     { [+]
     }
     { [+]
     }
     { [+]
     }
     { [+]
     }
   ]
   events_count: 52
   labels: null
   leakspeed: 500ms
   machine_id: confidential-2@172.18.218.4
   message: Ip confidential performed 'crowdsecurity/http-crawl-non_statics' (52 events over 22.814207421s) at 2023-02-01 14:22:29.975537808 +0000 UTC
   remediation: true
   scenario: crowdsecurity/http-crawl-non_statics
   scenario_hash: f0fa40870cdeea7b0da40b9f132e9c6de5e32d584334ec8a2d355faa35cde01c
   scenario_version: 0.3
   simulated: false
   source: { [-]
    as_name: confidential
    as_number: confidential
    cn: FR
    ip: confidential
    latitude: confidential
    longitude: confidential
    range: 176.128.0.0/11
    scope: Ip
    value: confidential 
   }
   start_at: 2023-02-01T14:22:07.161331449Z
   stop_at: 2023-02-01T14:22:29.97553887Z &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I successfully accessed to the fields under 'source' with something like (source.ip, source.as_name) but i can not find a solution for accessing to the value of a field in 'events.meta.IsInEU'. I tried different things with the spath command but unfortunately none of these things worked. I think that the issue is because the fields in meta do not have the same format as in source:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;events: [ [-]
     { [-]
       meta: [ [-]
         { [+]
         }
         { [+]
         }
         {&amp;lt;shoud be a name here&amp;gt;: [-]
           key: IsInEU
           value: true
         }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you can see above, i think that it would be much easier if there was a name here so i can access to the under key and value (events.meta.should_be_a_name_here.key|value). I don't know if there is some kind of index which i could put to access the data like events{}.meta{0}.key|value. Also i didn't expand the other fields that are aligned with meta because they're all named 'meta' and structure under them is the same than the one which you can see for the first one.&lt;/P&gt;
&lt;P&gt;The purpose for all of this would be to make operation such as 'stats count by &amp;lt;value of the key IsInEU'&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for all your answers&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 18:41:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-Crowdsec-json-logs-fields-extraction/m-p/629154#M218543</guid>
      <dc:creator>NEHS</dc:creator>
      <dc:date>2023-02-01T18:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve Crowdsec json logs fields extraction?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-Crowdsec-json-logs-fields-extraction/m-p/629277#M218586</link>
      <description>&lt;P&gt;Hi ! Shivam from CrowdSec here. Although I'm not very familiar with Splunk, you can simplify the JSON pushed by CrowdSec to Splunk. This would make your data extraction logic simpler too.&lt;/P&gt;&lt;P&gt;To do this you'd need to override the "format" parameter at "&lt;SPAN&gt;/etc/crowdsec/notifications/splunk.yaml" . The "format" parameter is gotemplate which receives an &lt;A href="https://docs.crowdsec.net/docs/notification_plugins/intro#alert-object" target="_self"&gt;alert object&lt;/A&gt;&amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let us know if you need help here or on our &lt;A href="https://discord.gg/crowdsec" target="_self"&gt;discord&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 06:59:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-achieve-Crowdsec-json-logs-fields-extraction/m-p/629277#M218586</guid>
      <dc:creator>sbs2001</dc:creator>
      <dc:date>2023-02-02T06:59:54Z</dc:date>
    </item>
  </channel>
</rss>

