<?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: Extracting a network address from a trap message in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152873#M2487</link>
    <description>&lt;P&gt;thanks for the reply G&lt;BR /&gt;
this did not produce any results i'm afraid. I notice your regex includes a reference to the osType.  This could differ depending on the message coming in and may not be present in some trap messages.  &lt;/P&gt;

&lt;P&gt;From the following line:&lt;/P&gt;

&lt;P&gt;cidsAlertVictimAddress:= osIdSource="unknown" osRelevance="relevant" osType="unknown" 10.37.99.223:161 &lt;/P&gt;

&lt;P&gt;I only need to search on the victim ip network address 10.37.  i would just need to ignore all other characters on this line if possible.&lt;/P&gt;</description>
    <pubDate>Sat, 23 Nov 2013 15:25:13 GMT</pubDate>
    <dc:creator>smithjnick</dc:creator>
    <dc:date>2013-11-23T15:25:13Z</dc:date>
    <item>
      <title>Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152870#M2484</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;

&lt;P&gt;I am trying to create an alert that triggers whenever i receive a high risk notification from my IPS.  I have my splunk search term below that returns the correct trap message, but i need to know how i can filter further by the victims network address.  The victims IP is contained in the following line: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      cidsAlertVictimAddress:= osIdSource="unknown" osRelevance="relevant" osType="unknown" 10.37.99.223:161
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to trigger my alert whenever this trap message comes in from any 10.37.0.0 source.  I had a bash at regex but couldnt get past:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      | rex field=cidsAlertVictimAddress
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Splunk query is this:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      index=myindex source=ips  sourcetype=ips_threat
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What do i need to append my query with in order to only alert on the victimaddress sitting on network 10.37.0.0&lt;/P&gt;

&lt;P&gt;The trap message looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 11/22/2013 4:13 PM 123.123.123.123:123.123.123.123  CISCO-CIDS-MIB:ciscoCidsAlert  SNMP Trap
 Received Time:11/22/2013 4:13:58 PM
 Source:456.456.456.456(456.456.456.456)
 Community:public
 Variable Bindings
      sysUpTime:= 112 days 19 hours 59 minutes 37.05 seconds (974877705)
      snmpTrapOID:= CISCO-CIDS-MIB:ciscoCidsAlert (1.3.6.1.4.1.9.9.383.0.1)
      cidsGeneralEventId:= 1323036804139549916
      cidsGeneralLocalTime:= 11/22/2013 4:13:58 PM (B90LFhANOgA=)
      cidsGeneralUTCTime:= 11/22/2013 4:13:58 PM (B90LFhANOgA=)
      cidsGeneralOriginatorHostId:= ZBTDCSRMP002
      cidsAlertSeverity:= high
      cidsAlertAlarmTraits:= 2147483648
      cidsAlertSignature:= Community Invalid Length
      cidsAlertSignatureSigName:= SNMP Protocol Violation
      cidsAlertSignatureSigId:= 4507
      cidsAlertSignatureSubSigId:= 6
      cidsAlertSignatureVersion:= S17
      cidsAlertInterfaceGroup:= 0
      cidsAlertVlan:= 0
      cidsAlertAttackerAddress:= 192.168.188.20:50556
      cidsAlertVictimAddress:= osIdSource="unknown" osRelevance="relevant" osType="unknown" 10.37.99.223:161
      cidsAlertDetails:= InterfaceAttributes:  context="single_vf" physical="Unknown" backplane="GigabitEthernet0/1" ; 
      cidsAlertEventRiskRating:= 100
      cidsAlert.26:= 3
      cidsAlert.27:= 17
      cidsAlert.42:= 65
      cidsAlert.46:= 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any help appreciated&lt;BR /&gt;
ta&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 18:43:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152870#M2484</guid>
      <dc:creator>smithjnick</dc:creator>
      <dc:date>2013-11-22T18:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152871#M2485</link>
      <description>&lt;P&gt;Your query should be something like this&lt;/P&gt;

&lt;PRE&gt;
index=myindex source=ips  sourcetype=ips_threat | rex "(?m)osType=\W\S*\W\s(?P&lt;VICTIM_IP&gt;.*?)\:" | search VICTIM_IP="10.37.0.0"
&lt;/VICTIM_IP&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2013 19:16:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152871#M2485</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2013-11-22T19:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152872#M2486</link>
      <description>&lt;P&gt;Try following. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex source=ips  sourcetype=ips_threat
| rex  "(?&amp;lt;victim_ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" | eval shouldAlert=if(match(victim_ip, "10\.37\.\d{1,3}\.\d{1,3}$"), "Yes", "No") | where shouldAlert="Yes"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Alert should be raised if above search returns rows.&lt;/P&gt;

&lt;P&gt;This search is searching all the IPs in the form 10.37.XXX.XXX.&lt;BR /&gt;
To search 10.37.0.XXX, use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"10\.37\.0\.\d{1,3}$". 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;Updated Search &lt;/H2&gt;

&lt;P&gt;There should work for  you (tested with sample data you posted [should have done this earlier])&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myindex source=ips  sourcetype=ips_threat
    | rex  "cidsAlertVictimAddress.* (?&amp;lt;victim_ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" | eval shouldAlert=if(match(victim_ip, "10\.37\.\d{1,3}\.\d{1,3}$"), "Yes", "No") | where shouldAlert="Yes"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2013 21:45:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152872#M2486</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-22T21:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152873#M2487</link>
      <description>&lt;P&gt;thanks for the reply G&lt;BR /&gt;
this did not produce any results i'm afraid. I notice your regex includes a reference to the osType.  This could differ depending on the message coming in and may not be present in some trap messages.  &lt;/P&gt;

&lt;P&gt;From the following line:&lt;/P&gt;

&lt;P&gt;cidsAlertVictimAddress:= osIdSource="unknown" osRelevance="relevant" osType="unknown" 10.37.99.223:161 &lt;/P&gt;

&lt;P&gt;I only need to search on the victim ip network address 10.37.  i would just need to ignore all other characters on this line if possible.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Nov 2013 15:25:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152873#M2487</guid>
      <dc:creator>smithjnick</dc:creator>
      <dc:date>2013-11-23T15:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152874#M2488</link>
      <description>&lt;P&gt;thanks for your reply S&lt;BR /&gt;
this search also produced no hits for me.  Would your regex above search the whole trap message for a network address beginning 10.37?  Reason i ask is that i do not see any reference directed at line cidsAlertVictimAddress?  This is the line i need to focus on for generating an alert or search result.&lt;/P&gt;

&lt;P&gt;From your post though i am gaining a better understanding of the regex query and i find the ability to change the victim ip search query quite useful as this is also a requirement of mine.  cheers.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Nov 2013 15:30:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152874#M2488</guid>
      <dc:creator>smithjnick</dc:creator>
      <dc:date>2013-11-23T15:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152875#M2489</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;
index=myindex source=ips  sourcetype=ips_threat | rex "(?i)(?P&lt;VICTIM_IP&gt;.*?\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\:\d+" | search VICTIM_IP="10.37*"
&lt;/VICTIM_IP&gt;&lt;/PRE&gt;

&lt;P&gt;Make sure the case of VICTIM_IP is same in the both the places in the query. For some reason this page is converting to lower case on the regex&lt;/P&gt;</description>
      <pubDate>Sat, 23 Nov 2013 22:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152875#M2489</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2013-11-23T22:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152876#M2490</link>
      <description>&lt;P&gt;updated the answer.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2013 08:20:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152876#M2490</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-24T08:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152877#M2491</link>
      <description>&lt;P&gt;many thanks S - this worked a treat and does exactly what i need it to do.  Without pushing you too much, how could i refine this search to include other network addresses i.e. 10.37 OR 10.28 OR 10.20.30 etc...&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2013 14:38:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152877#M2491</guid>
      <dc:creator>smithjnick</dc:creator>
      <dc:date>2013-11-25T14:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a network address from a trap message</title>
      <link>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152878#M2492</link>
      <description>&lt;P&gt;You can add all thos in the shouldAlert eval command.e.g.&lt;BR /&gt;
if(match(victim_ip, "10\.37\.\d{1,3}\.\d{1,3}$") OR match(victim_ip, "10\.28\.\d{1,3}\.\d{1,3}$"), "Yes", "No")&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:21:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Extracting-a-network-address-from-a-trap-message/m-p/152878#M2492</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T15:21:39Z</dc:date>
    </item>
  </channel>
</rss>

