<?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: Trying to slip SNMP data on index or through rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307947#M92397</link>
    <description>&lt;P&gt;Is it currently a multi-line event (it looks like one in the question)?&lt;BR /&gt;
What are your current props.conf/transforms.conf settings for that sourcetype?&lt;BR /&gt;
What will the number after the = sign be extracted as?&lt;/P&gt;</description>
    <pubDate>Wed, 29 Nov 2017 19:36:52 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2017-11-29T19:36:52Z</dc:date>
    <item>
      <title>Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307946#M92396</link>
      <description>&lt;P&gt;All,&lt;/P&gt;

&lt;P&gt;I have the following Data: (192 of these) and trying to split the data into a multi-lined event, to extract  the last number as  1.1.3.1.3.2.1.25.1 and the number after the = sign as the  .&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;11/29/17
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;11:04:30.000 AM &lt;BR /&gt;
SNMPv2-SMI::enterprises."1.1.3.1.3.2.1.25.1" = "1162" SNMPv2-SMI::enterprises."1.1.3.1.3.2.1.25.2" = "0" &lt;/P&gt;

&lt;P&gt;I am trying to do this on index but can't seem to get it to work, or I can't get it to work using rex.  Any help will be much appreciated.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Stephen Robinson&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 19:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307946#M92396</guid>
      <dc:creator>srobinsonxtl</dc:creator>
      <dc:date>2017-11-29T19:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307947#M92397</link>
      <description>&lt;P&gt;Is it currently a multi-line event (it looks like one in the question)?&lt;BR /&gt;
What are your current props.conf/transforms.conf settings for that sourcetype?&lt;BR /&gt;
What will the number after the = sign be extracted as?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 19:36:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307947#M92397</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-11-29T19:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307948#M92398</link>
      <description>&lt;P&gt;No it's not a multi-lined event at least I don't believe so.  Here is my props.conf information and I don't have anything in Transforms for this sourcetype&lt;/P&gt;

&lt;P&gt;[sourcetype_test]&lt;BR /&gt;
LINE_BREAKER=([\r\n]+\s*)SNMPv2-SMI&lt;BR /&gt;
NO_BINARY_CHECK=1&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;/P&gt;

&lt;P&gt;1.1.3.1.3.2.1.25.{1} that value should be {id} and "1.1.3.1.3.2.1.25.1" = &amp;lt;"1162"&amp;gt; this value should be  &amp;lt;"Reading"&amp;gt;&lt;/P&gt;

&lt;P&gt;I am leveraging the SNMP Modular Input application.  I really appreciate you getting back to me so quickly.&lt;/P&gt;

&lt;P&gt;THanks,&lt;/P&gt;

&lt;P&gt;Stephen Robinson&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:58:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307948#M92398</guid>
      <dc:creator>srobinsonxtl</dc:creator>
      <dc:date>2020-09-29T16:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307949#M92399</link>
      <description>&lt;P&gt;At the end of the day, I would like to see the {id} as the field, and  as the value, so I would have 192 fields with 192 values.&lt;/P&gt;

&lt;P&gt;1 | 2 | 3 | 4| .....192&lt;BR /&gt;
20| 43 | 80 | 100 | ..... 0&lt;/P&gt;

&lt;P&gt;If this make sense.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Stephen Robinson&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 19:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307949#M92399</guid>
      <dc:creator>srobinsonxtl</dc:creator>
      <dc:date>2017-11-29T19:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307950#M92400</link>
      <description>&lt;P&gt;Still I am not clear how many &lt;CODE&gt;SNMPv2-SMI&lt;/CODE&gt; in single line and do you want to extract all MIB values from same line  If so then you can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | makeresults
    | eval raw="11/29/17 11:04:30.000 AM SNMPv2-SMI::enterprises.\"1.1.3.1.3.2.1.25.1\" = \"1162\" SNMPv2-SMI::enterprises.\"1.1.3.1.3.2.1.25.2\" = \"0\""
    | makemv delim="::" raw
    | mvexpand raw
    | rex field=raw "enterprises\.\"\d+\.\d+\.\d+\.\d+\.\d+\.\d+\.\d+\.\d+\.(?&amp;lt;id&amp;gt;\d+)\"\s\=\s\"(?&amp;lt;Reading&amp;gt;\d+)\""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Nov 2017 03:47:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307950#M92400</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-11-30T03:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307951#M92401</link>
      <description>&lt;P&gt;It's seems your LINE_BREAKER setting will cut off the timestamp from the event.  Is that really what you want?&lt;/P&gt;

&lt;P&gt;To extract the "id" and "Reading" fields from the event, this regex works on regex101.com with your sample event: &lt;CODE&gt;(?&amp;lt;id&amp;gt;\d+)".*=\s"(?&amp;lt;Reading&amp;gt;\d+)"&lt;/CODE&gt;.  For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your basic search&amp;gt; | rex "(?&amp;lt;id&amp;gt;\d+)\".*=\s\"(?&amp;lt;Reading&amp;gt;\d+)" | table id Reading
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Nov 2017 13:57:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307951#M92401</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-11-30T13:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307952#M92402</link>
      <description>&lt;P&gt;Thank you for your response.  I tried this and it doesn't seem to work.  I have 192 SNMPv2-SMI that comes in on the single line for each poll.&lt;/P&gt;

&lt;P&gt;Working through some trial and errors yesterday, I came up with the following but its not vary efficient.&lt;/P&gt;

&lt;P&gt;index="dev" | eval _raw = split(_raw, "SNMPv2-SMI::enterprises.") | rex field=_raw "10381.1.3.1.3.2.1.1.?(?\d+)[\"]\s=\s[\"]?(?\d+)[\"]"  | table _time,cid,vid | eval reading=mvzip(cid, vid) | fields - cid,vid|  mvexpand reading | eval final=mvzip(reading, _time) | mvexpand final |  makemv final delim="," | fields - _time,reading | eval time=mvindex(final, 2) | eval device=mvindex(final, 0) | eval data=mvindex(final, 1) | fields - final | table time,device,data | convert timeformat="%Y/%m/%d %T" mktime(time) as _time | fields - time | eval {device}=data | fields - device,data | fillnull | timechart sum(&lt;EM&gt;) as (Device&lt;/EM&gt;) usenull=f useother=f | addtotals  as Total&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:59:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307952#M92402</guid>
      <dc:creator>srobinsonxtl</dc:creator>
      <dc:date>2020-09-29T16:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307953#M92403</link>
      <description>&lt;P&gt;Thank you for responding to my questions, this works, but just returns the first id and Reading,  the end goal is to extract all 192 values that are on a single line, and output the id and reading into a multi-lined event.  I would like to do it at index time, but it doesn't seem to be working using the props.conf I put in place.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 16:43:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307953#M92403</guid>
      <dc:creator>srobinsonxtl</dc:creator>
      <dc:date>2017-11-30T16:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307954#M92404</link>
      <description>&lt;P&gt;Thanks for clarifying.  Here is an updated query for search-time extraction.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your basic search&amp;gt; | rex max_match=0 "(?&amp;lt;id&amp;gt;\d+)\"\s+=\s\"(?&amp;lt;Reading&amp;gt;\d+)" | eval fields=mvzip(id, Reading) | mvexpand fields | rex field=fields "(?&amp;lt;id&amp;gt;\d+),(?&amp;lt;Reading&amp;gt;\d+)" | table id Reading
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;At index time you should be able to use the same regex string ("(?\d+)"\s+=\s"(?\d+)"), but be sure to include the &lt;CODE&gt;mv_add = true&lt;/CODE&gt; option.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 18:33:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307954#M92404</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-11-30T18:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to slip SNMP data on index or through rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307955#M92405</link>
      <description>&lt;P&gt;Just to let you know and I took you example, and did the following in less steps:  | rex max_match=0 "(?\d+)\"\s+=\s\"(?\d+)" | stats list(id),list(Reading) by _time,host&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 21:38:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-slip-SNMP-data-on-index-or-through-rex/m-p/307955#M92405</guid>
      <dc:creator>srobinsonxtl</dc:creator>
      <dc:date>2017-11-30T21:38:46Z</dc:date>
    </item>
  </channel>
</rss>

