<?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 do I do lookups based on many forms of regex/event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57392#M14011</link>
    <description>&lt;P&gt;My suggestion is -
Edit props.conf and change all the &lt;STRONG&gt;Username1 Username2&lt;/STRONG&gt; etc. to just &lt;STRONG&gt;Username&lt;/STRONG&gt;, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[syslog]
EXTRACT-U1 = (?i) for (?P&amp;lt;Username&amp;gt;[^ ]+)
EXTRACT-U2 = (?i) (?P&amp;lt;Username&amp;gt;[^ ]+) authenticated as
LOOKUP-username = employee uid AS Username  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the different extraction identifiers must be unique - but the field name itself can be the same.  This is good, because it really is the same field, it just appears in different places in different events.&lt;/P&gt;

&lt;P&gt;Now you only need one lookup, on the Username field.  Note that I also renamed the lookup to LOOKUP-username, although the lookup identifier really doesn't matter.&lt;/P&gt;

&lt;P&gt;I think this solution will make searches and reporting easier overall, as well as simplifying your lookups.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2011 04:11:33 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2011-03-17T04:11:33Z</dc:date>
    <item>
      <title>How do I do lookups based on many forms of regex/event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57391#M14010</link>
      <description>&lt;P&gt;I'm having no success making sense of lookups.  Some work, some don't, and I can't figure out why.  Let's take an obvious example.  sshd syslogs in all sorts of formats which indicate the username.  I want to extract the username field from those various forms, then look that username up in my external CSV file.  I know how to get that working in basic form, and have done it for &lt;EM&gt;one&lt;/EM&gt; form of sshd syslog line.&lt;/P&gt;

&lt;P&gt;Specifically, we have sshd events like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user usernameHere authenticated as blahblah
session opened for usernameHere
session closed for usernameHere
Accepted someAuthMethod for usernameHere
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All of those (defined as field extractions) need to trigger a lookup of usernameHere in the CSV file which is already defined in transforms.conf as 'employee'&lt;/P&gt;

&lt;P&gt;The following does not work completely (only the "authenticated as" part looks up):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[syslog]
LOOKUP-username1 = employee uid AS Username1
EXTRACT-Username1 = (?i) for (?P&amp;lt;Username1&amp;gt;[^ ]+)
LOOKUP-username2 = employee uid AS Username2
EXTRACT-Username2 = (?i) (?P&amp;lt;Username2&amp;gt;[^ ]+) authenticated as
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Nor does this ordering (a shot in the dark):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[syslog]
EXTRACT-Username1 = (?i) for (?P&amp;lt;Username1&amp;gt;[^ ]+)
EXTRACT-Username2 = (?i) (?P&amp;lt;Username2&amp;gt;[^ ]+) authenticated as
LOOKUP-username2 = employee uid AS Username2
LOOKUP-username1 = employee uid AS Username1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I remove the functioning "authenticated as" LOOKUP and EXTRACT, then the &lt;STRONG&gt;other one starts working&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;I have also tried the following, fixing the case of my LOOKUP classes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[syslog]
EXTRACT-Username1 = (?i) for (?P&amp;lt;Username1&amp;gt;[^ ]+)
LOOKUP-Username1 = employee uid AS Username1
EXTRACT-Username2 = (?i) (?P&amp;lt;Username2&amp;gt;[^ ]+) authenticated as
LOOKUP-Username2 = employee uid AS Username2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So clearly I am not understanding the relationship between the field extraction and the lookup.&lt;/P&gt;

&lt;P&gt;Really what I want is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my_sshd_extraction1 to store username
my_sshd_extraction2 to store username
my_sshd_extraction3 to store username
my_sshd_extraction4 to store username
lookup username for any of those!
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2011 06:10:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57391#M14010</guid>
      <dc:creator>jblaine</dc:creator>
      <dc:date>2011-03-11T06:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do lookups based on many forms of regex/event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57392#M14011</link>
      <description>&lt;P&gt;My suggestion is -
Edit props.conf and change all the &lt;STRONG&gt;Username1 Username2&lt;/STRONG&gt; etc. to just &lt;STRONG&gt;Username&lt;/STRONG&gt;, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[syslog]
EXTRACT-U1 = (?i) for (?P&amp;lt;Username&amp;gt;[^ ]+)
EXTRACT-U2 = (?i) (?P&amp;lt;Username&amp;gt;[^ ]+) authenticated as
LOOKUP-username = employee uid AS Username  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the different extraction identifiers must be unique - but the field name itself can be the same.  This is good, because it really is the same field, it just appears in different places in different events.&lt;/P&gt;

&lt;P&gt;Now you only need one lookup, on the Username field.  Note that I also renamed the lookup to LOOKUP-username, although the lookup identifier really doesn't matter.&lt;/P&gt;

&lt;P&gt;I think this solution will make searches and reporting easier overall, as well as simplifying your lookups.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2011 04:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57392#M14011</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-03-17T04:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do lookups based on many forms of regex/event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57393#M14012</link>
      <description>&lt;P&gt;Awesome.  That works.  Now the problem is that [syslog|linux_secure] isn't working.  If I break my stuff out (duplicate the field extraction definitions) into [syslog] and also [linux_secure], they all work.  Combined with an 'or' pipe, they don't.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:26:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57393#M14012</guid>
      <dc:creator>jblaine</dc:creator>
      <dc:date>2020-09-28T09:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do lookups based on many forms of regex/event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57394#M14013</link>
      <description>&lt;P&gt;PS: &lt;EM&gt;Comment&lt;/EM&gt; formatting controls here at Answers are greatly needed.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2011 01:20:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57394#M14013</guid>
      <dc:creator>jblaine</dc:creator>
      <dc:date>2011-03-18T01:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do lookups based on many forms of regex/event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57395#M14014</link>
      <description>&lt;P&gt;Stanza names in props.conf aren't normal regexes.  Here are the rules:&lt;/P&gt;

&lt;P&gt;When setting a [&lt;SPEC&gt;] stanza, you can use the following regex-type syntax:&lt;BR /&gt;&lt;BR /&gt;
... recurses through directories&lt;BR /&gt;&lt;BR /&gt;
*   matches anything but / 0 or more times&lt;BR /&gt;&lt;BR /&gt;
|   is equivalent to 'or'&lt;BR /&gt;&lt;BR /&gt;
( ) are used to limit scope of |&lt;BR /&gt;&lt;/SPEC&gt;&lt;/P&gt;

&lt;P&gt;So [syslog|linux_secure] should work.  This is either a bug in the code, or an error in the documentation. &lt;/P&gt;

&lt;P&gt;Question: where do you set the sourcetypes of syslog and linux_secure?  inputs.conf?  If it's in props.conf, you need to look at the priority and ordering of stanzas in props.conf&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2011 16:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-do-lookups-based-on-many-forms-of-regex-event/m-p/57395#M14014</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-05-22T16:11:46Z</dc:date>
    </item>
  </channel>
</rss>

