<?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 edit my rex statement to these two fields from my sample SNMP trap data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270478#M81418</link>
    <description>&lt;P&gt;I try to follow the Keep It Simple maxim in my regex strings.  This works in regex101.com&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex ":(?&amp;lt;Board&amp;gt;[^,]+), (?&amp;lt;Port&amp;gt;[^,]+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Sep 2016 16:50:17 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2016-09-08T16:50:17Z</dc:date>
    <item>
      <title>How to edit my rex statement to these two fields from my sample SNMP trap data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270477#M81417</link>
      <description>&lt;P&gt;I have an SNMP trap that I'm trying to extract two fields from one string with a comma in the middle, but I'm getting no output from the segment of a field extraction for the comma separated pair of values.&lt;/P&gt;

&lt;P&gt;The input includes (from raw_) {1.3.6.1.4.1.1482.20.1.2.1.4.1.5.21914:Board 3, Port 1, TS 0.0.0.0:1235}&lt;/P&gt;

&lt;P&gt;So I want to output "Board 3"  and "Port 1" in two Fields called &lt;STRONG&gt;Board&lt;/STRONG&gt; and &lt;STRONG&gt;Port&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;When I use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=raw_ "1\.3\.6\.1\.4\.1\.1482\.20\.1\.2\.1\.4\.1\.5\.\d+:(?P\w+\d+\s+),(?\w+\d+\s+)}" | table _time, Board, Port
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get nothing for the fields Board or Port in the output. I've no issues with getting a bunch of other fields from this trap, but this one escapes me....&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 16:31:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270477#M81417</guid>
      <dc:creator>cadfael</dc:creator>
      <dc:date>2016-09-08T16:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex statement to these two fields from my sample SNMP trap data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270478#M81418</link>
      <description>&lt;P&gt;I try to follow the Keep It Simple maxim in my regex strings.  This works in regex101.com&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex ":(?&amp;lt;Board&amp;gt;[^,]+), (?&amp;lt;Port&amp;gt;[^,]+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2016 16:50:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270478#M81418</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-09-08T16:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex statement to these two fields from my sample SNMP trap data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270479#M81419</link>
      <description>&lt;P&gt;Ah, unfortunately, there are a plethora of varbinds in the SNMP trap, with many semicolons. Here's a sample of the full trap&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[2016/09/08 10:57:16 MDT] [INFO] (/trapd/client.(*TrapLogger).Info:29) [TRAP]: {ip:69.76.108.44,timestamp:1473353836411,oid:1.3.6.1.4.1.1482.20.1.1.1.1.0.1,varbinds:[{1.3.6.1.4.1.1482.20.1.2.1.4.1.13.5460:2},{1.3.6.1.4.1.1482.20.1.2.1.4.1.9.5460:8},{1.3.6.1.4.1.1482.20.1.2.1.4.1.11.5460:&amp;#1;},{1.3.6.1.4.1.1482.20.1.2.1.4.1.14.5460:TS=232.34.1.232:34000=;Cause=Service Out Loss (one service)=;},{1.3.6.1.4.1.1482.20.1.2.1.4.1.5.5460:**Board 5, Port 1**, TS 232.34.1.232:34000},{1.3.6.1.4.1.1482.20.1.2.1.4.1.8.5460:1},{1.3.6.1.4.1.1482.20.1.2.1.4.1.10.5460:269},{1.3.6.1.2.1.1.3.0:1041h33m58.73s},{1.3.6.1.4.1.1482.20.1.2.1.4.1.3.5460:DCM},{1.3.6.1.4.1.1482.20.1.2.1.4.1.4.5460:TS Out Loss},{1.3.6.1.4.1.1482.20.1.2.1.4.1.6.5460:2016/09/08 16:57:14},{1.3.6.1.4.1.1482.20.1.2.1.4.1.7.5460:2},{1.3.6.1.4.1.1482.20.1.2.1.4.1.12.5460:0},{1.3.6.1.4.1.1482.20.1.2.1.4.1.15.5460:.1.3.6.1.2.1.47.1.1.1.1.1.501},{1.3.6.1.4.1.1482.20.1.2.1.4.1.2.5460:5460}]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I added in the preamble from the varbind I'm after to get to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=raw_ "1\.3\.6\.1\.4\.1\.1482\.20\.1\.2\.1\.4\.1\.5\.[\d]+:(?[^,]+), (?[^,]+)" | table, _time, Board, Port
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;unfortunately, still did not return anything....&lt;/P&gt;

&lt;P&gt;(FWIW, I did also try verbatim the rex &lt;CODE&gt;":(?[^,]+), (?[^,]+)"&lt;/CODE&gt; and it failed to return anything either)&lt;/P&gt;

&lt;P&gt;S&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 17:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270479#M81419</guid>
      <dc:creator>cadfael</dc:creator>
      <dc:date>2016-09-08T17:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex statement to these two fields from my sample SNMP trap data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270480#M81420</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Board\s+(?&amp;lt;board&amp;gt;\d+),\s+Port\s+(?&amp;lt;port&amp;gt;\d+)" | table _time board port
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2016 17:09:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270480#M81420</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-08T17:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex statement to these two fields from my sample SNMP trap data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270481#M81421</link>
      <description>&lt;P&gt;It works in my Splunk (6.4.1).  Here's a run-anywhere example.  Remove the &lt;CODE&gt;\*\*&lt;/CODE&gt; sequences if you just added the asterisks for emphasis.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|metadata type=sources | head 1 | eval text="[2016/09/08 10:57:16 MDT] [INFO] (/trapd/client.(*TrapLogger).Info:29) [TRAP]: {ip:69.76.108.44,timestamp:1473353836411,oid:1.3.6.1.4.1.1482.20.1.1.1.1.0.1,varbinds:[{1.3.6.1.4.1.1482.20.1.2.1.4.1.13.5460:2},{1.3.6.1.4.1.1482.20.1.2.1.4.1.9.5460:8},{1.3.6.1.4.1.1482.20.1.2.1.4.1.11.5460:&amp;#1;},{1.3.6.1.4.1.1482.20.1.2.1.4.1.14.5460:TS=232.34.1.232:34000=;Cause=Service Out Loss (one service)=;},{1.3.6.1.4.1.1482.20.1.2.1.4.1.5.5460:**Board 5, Port 1**, TS 232.34.1.232:34000},{1.3.6.1.4.1.1482.20.1.2.1.4.1.8.5460:1},{1.3.6.1.4.1.1482.20.1.2.1.4.1.10.5460:269},{1.3.6.1.2.1.1.3.0:1041h33m58.73s},{1.3.6.1.4.1.1482.20.1.2.1.4.1.3.5460:DCM},{1.3.6.1.4.1.1482.20.1.2.1.4.1.4.5460:TS Out Loss},{1.3.6.1.4.1.1482.20.1.2.1.4.1.6.5460:2016/09/08 16:57:14},{1.3.6.1.4.1.1482.20.1.2.1.4.1.7.5460:2},{1.3.6.1.4.1.1482.20.1.2.1.4.1.12.5460:0},{1.3.6.1.4.1.1482.20.1.2.1.4.1.15.5460:.1.3.6.1.2.1.47.1.1.1.1.1.501},{1.3.6.1.4.1.1482.20.1.2.1.4.1.2.5460:5460}]" | rex field=text ":(?&amp;lt;Board&amp;gt;\*\*Board [^,]+), (?&amp;lt;Port&amp;gt;Port[^,]+\*\*)" | table _time Board Port
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Sep 2016 17:18:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270481#M81421</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-09-08T17:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my rex statement to these two fields from my sample SNMP trap data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270482#M81422</link>
      <description>&lt;P&gt;Yep, that got it. &lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 17:26:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-rex-statement-to-these-two-fields-from-my-sample/m-p/270482#M81422</guid>
      <dc:creator>cadfael</dc:creator>
      <dc:date>2016-09-08T17:26:08Z</dc:date>
    </item>
  </channel>
</rss>

