<?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 How to create custom alert script to initiate tcpdump? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-alert-script-to-initiate-tcpdump/m-p/588683#M13572</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I am trying to create a custom alert action where tcpdump capture will be triggered for the event's src and dest IPs.&lt;/P&gt;
&lt;P&gt;I created a simple bash script for that:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#!/bin/bash
#Initiate tcpdump (3 dumps for 5mins each)
tcpdump -i ens33 -G 300 -W 3 -w /mnt/nfs/pcaps/pcap-%Y-%m-%d_%H.%M.%S&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is that this does not contain the &lt;STRONG&gt;src&amp;nbsp;&lt;/STRONG&gt;and &lt;STRONG&gt;dest&lt;/STRONG&gt; IPs of the correlation event triggered. How can I pass these variables here in order not to capture the whole traffic, but only the one related between these two hosts?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Chris&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 12 Mar 2022 05:09:09 GMT</pubDate>
    <dc:creator>b_chris21</dc:creator>
    <dc:date>2022-03-12T05:09:09Z</dc:date>
    <item>
      <title>How to create custom alert script to initiate tcpdump?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-alert-script-to-initiate-tcpdump/m-p/588683#M13572</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I am trying to create a custom alert action where tcpdump capture will be triggered for the event's src and dest IPs.&lt;/P&gt;
&lt;P&gt;I created a simple bash script for that:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#!/bin/bash
#Initiate tcpdump (3 dumps for 5mins each)
tcpdump -i ens33 -G 300 -W 3 -w /mnt/nfs/pcaps/pcap-%Y-%m-%d_%H.%M.%S&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is that this does not contain the &lt;STRONG&gt;src&amp;nbsp;&lt;/STRONG&gt;and &lt;STRONG&gt;dest&lt;/STRONG&gt; IPs of the correlation event triggered. How can I pass these variables here in order not to capture the whole traffic, but only the one related between these two hosts?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Chris&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2022 05:09:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-alert-script-to-initiate-tcpdump/m-p/588683#M13572</guid>
      <dc:creator>b_chris21</dc:creator>
      <dc:date>2022-03-12T05:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom alert script to initiate tcpdump</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-alert-script-to-initiate-tcpdump/m-p/588762#M13573</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The alert action script receives the configuration and results from the stdin in json format..&amp;nbsp;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"app"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"search"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"owner"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"admin"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"results_file"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"heregoesthecreditcardnumber"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"results_link"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"heregoesthecreditcardnumber"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"search_uri"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"/servicesNS/nobody/search/saved/searches/testalert"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"server_host"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"art-mb-2.local"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"server_uri"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"heregoesthecreditcardnumber"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"session_key"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"heregoesthecreditcardnumber"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"sid"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"scheduler__admin__search__testalert_at_1569508320_128"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"search_name"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"testalert"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"configuration"&lt;/SPAN&gt;&lt;SPAN&gt;: {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"email"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"andreas at batchworks.de"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"company"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"batchworks"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"severity"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"WARNING"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;},&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"result"&lt;/SPAN&gt;&lt;SPAN&gt;: {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"sourcetype"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"splunkd"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"count"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"80"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;in "result" there are your search results.. read this in python like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;result = sys.stdin.read() settings = json.loads(result)regards,​&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 16:20:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-alert-script-to-initiate-tcpdump/m-p/588762#M13573</guid>
      <dc:creator>schose</dc:creator>
      <dc:date>2022-03-11T16:20:56Z</dc:date>
    </item>
  </channel>
</rss>

