<?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 Complex regex help in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86837#M5630</link>
    <description>&lt;P&gt;I've tried a few tools to try and write the proper regex syntax to do what I want, but I'm not having any luck.&lt;/P&gt;

&lt;P&gt;I have syslog output that comes from two different device types that comes out with different fields whether it's one device type or the other:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Oct  5 09:02:40 10.219.49.2 66772: bfr01.151front711 RP/0/RSP0/CPU0:Oct  5 09:02:40.861 : exec[65706]: %SECURITY-login-6-AUTHEN_SUCCESS : Successfully authenticated user 'rancid' from '10.219.51.130' on 'vty0'
Oct  5 08:12:29 10.219.49.31 146074: bpe01.77mowat506: Oct  5 08:12:28.623: %LINK-3-UPDOWN: Interface Virtual-Access45, changed state to down
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The important fields are the hostname which appears in field 6 in both lines and as Cisco calls it "%message-group-severity-message-code" which appears in two different fields depending on the device.&lt;/P&gt;

&lt;P&gt;Using the field extrator, I can generate a regex that captures the hostname:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(?:[^:\n]*:){6}\s+(?P&amp;lt;FIELDNAME1&amp;gt;[^ ]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I can't figure out how to get field extractor to also capture the %message as a different field.  Heck, I can't even get it to reliably match %message in the first place.  It doesn't seem to understand when I enter copy and paste different values from two different fields and ask it to match against it.&lt;/P&gt;

&lt;P&gt;I'd be grateful of for any assistance.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2011 14:12:24 GMT</pubDate>
    <dc:creator>jlixfeld</dc:creator>
    <dc:date>2011-10-05T14:12:24Z</dc:date>
    <item>
      <title>Complex regex help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86837#M5630</link>
      <description>&lt;P&gt;I've tried a few tools to try and write the proper regex syntax to do what I want, but I'm not having any luck.&lt;/P&gt;

&lt;P&gt;I have syslog output that comes from two different device types that comes out with different fields whether it's one device type or the other:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Oct  5 09:02:40 10.219.49.2 66772: bfr01.151front711 RP/0/RSP0/CPU0:Oct  5 09:02:40.861 : exec[65706]: %SECURITY-login-6-AUTHEN_SUCCESS : Successfully authenticated user 'rancid' from '10.219.51.130' on 'vty0'
Oct  5 08:12:29 10.219.49.31 146074: bpe01.77mowat506: Oct  5 08:12:28.623: %LINK-3-UPDOWN: Interface Virtual-Access45, changed state to down
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The important fields are the hostname which appears in field 6 in both lines and as Cisco calls it "%message-group-severity-message-code" which appears in two different fields depending on the device.&lt;/P&gt;

&lt;P&gt;Using the field extrator, I can generate a regex that captures the hostname:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(?:[^:\n]*:){6}\s+(?P&amp;lt;FIELDNAME1&amp;gt;[^ ]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I can't figure out how to get field extractor to also capture the %message as a different field.  Heck, I can't even get it to reliably match %message in the first place.  It doesn't seem to understand when I enter copy and paste different values from two different fields and ask it to match against it.&lt;/P&gt;

&lt;P&gt;I'd be grateful of for any assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 14:12:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86837#M5630</guid>
      <dc:creator>jlixfeld</dc:creator>
      <dc:date>2011-10-05T14:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Complex regex help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86838#M5631</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;From your email I understand that you are trying to collect "%SECURITY-login-6-AUTHEN_SUCCESS" and "%LINK-3-UPDOWN". This is the correct, have you tried this regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;: (?&amp;lt;FIELDNAME1&amp;gt;%[^:]+):
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this help.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Olivier&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 15:01:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86838#M5631</guid>
      <dc:creator>OL</dc:creator>
      <dc:date>2011-10-05T15:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Complex regex help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86839#M5632</link>
      <description>&lt;P&gt;Hi Oliver,&lt;/P&gt;

&lt;P&gt;You are partially right.  I perhaps didn't make my question clear enough.  I apologize.  I'd like to match %message as well as hostname.  I understand that the field extractor can extract multiple fields at once.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 15:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86839#M5632</guid>
      <dc:creator>jlixfeld</dc:creator>
      <dc:date>2011-10-05T15:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Complex regex help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86840#M5633</link>
      <description>&lt;P&gt;Sorry, I'm not sure that I can recognize the hostnames from the log but I'm guessing you want to get "bfr01.151front711 RP/0/RSP0/CPU0" and "bpe01.77mowat506", but would this one be OK:&lt;/P&gt;

&lt;P&gt;[^ ]+ [^ ]+ [^ ]+ [0-9]+: (?&lt;FIELDNAME1&gt;[^:]+).*: (?&lt;FIELDNAME2&gt;%[^:]+):&lt;/FIELDNAME2&gt;&lt;/FIELDNAME1&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 15:16:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86840#M5633</guid>
      <dc:creator>OL</dc:creator>
      <dc:date>2011-10-05T15:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Complex regex help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86841#M5634</link>
      <description>&lt;P&gt;Again, my apologies.  The hostname in the example would be either bfr01.151front711 or bpe01.77mowat506.&lt;/P&gt;

&lt;P&gt;I tried your second regex, and that works much better, except for one small issue.  It matches this as one field:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;bfr01.151front711 RP/0/RSP0/CPU0&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The one field should only be:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;bfr01.151front711&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 15:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86841#M5634</guid>
      <dc:creator>jlixfeld</dc:creator>
      <dc:date>2011-10-05T15:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Complex regex help</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86842#M5635</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?:\S*\s*){5}(?&amp;lt;hostname&amp;gt;\S*)[^%]*(?&amp;lt;message&amp;gt;%\S+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It could be more precise (e.g., it could define where after the hostname the message occurs, instead of just finding the first &lt;CODE&gt;%&lt;/CODE&gt;), but should work.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 16:57:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Complex-regex-help/m-p/86842#M5635</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-10-05T16:57:31Z</dc:date>
    </item>
  </channel>
</rss>

