<?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: Splunk creates field from from wrong string in my LDAP logs in Security</title>
    <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151008#M4593</link>
    <description>&lt;P&gt;Root cause:&lt;BR /&gt;
The reason this is occurring is because you have 2 key=value pairs with the same key. So Splunk will extract the first value into the key, and then overwrite it with the second value.&lt;/P&gt;

&lt;P&gt;Solution:&lt;BR /&gt;
Define a new field extraction that specifies exactly how you want the fields extracted.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;during the search&lt;/P&gt;

&lt;P&gt;your search ... | rex "from IP=(?P&lt;IP&gt;[^:]+?).*?(IP=(?P&lt;IP_2&gt;[^:])"&lt;/IP_2&gt;&lt;/IP&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;or using the field extraction to create a new field extraction object. You can use the above regex (what is inside the quotes).&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;If you do it this way, you'll get two fields, one called "IP" with the first IP, and another called "IP_2" with the second IP.&lt;/P&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;

&lt;P&gt;--- EDIT ---&lt;/P&gt;

&lt;P&gt;I edited my rex command to stop at the ":"; this is to avoid catching the port in the first IP.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Dec 2014 19:41:26 GMT</pubDate>
    <dc:creator>aholzer</dc:creator>
    <dc:date>2014-12-15T19:41:26Z</dc:date>
    <item>
      <title>Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151007#M4592</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;I am attempting to graph LDAP transactions from our OpenLDAP LDAP servers, however I'm having trouble getting Splunk to use the correct fields.&lt;/P&gt;

&lt;P&gt;In the example below, the first line of the transaction has two IP addresses, IP=192.168.1.111 &amp;amp; IP=0.0.0.0. Splunk assigns the field named&lt;CODE&gt;IP&lt;/CODE&gt; to &lt;CODE&gt;IP=0.0.0.0&lt;/CODE&gt;, but I want it to use the first field &lt;CODE&gt;IP=192.168.1.111&lt;/CODE&gt; instead. How can I tell Splunk to match  &lt;CODE&gt;IP=192.168.1.111&lt;/CODE&gt; &amp;amp; not &lt;CODE&gt;IP=0.0.0.0&lt;/CODE&gt;?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 fd=207 ACCEPT from IP=192.168.1.111:34792 (IP=0.0.0.0:389)
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=0 EXT oid=1.2.6.1.6.1.1666.37723
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=0 STARTTLS
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=0 RESULT oid= err=0 text=
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 fd=206 TLS established tls_ssf=256 ssf=256
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=1 BIND dn="" method=128
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=1 RESULT tag=97 err=0 text=
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=2 SRCH base="dc=example,dc=org" scope=0 deref=0 filter="(objectClass=*)"
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=2 SRCH attr=contextCSN
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=2 SEARCH RESULT tag=101 err=0 nentries=1 text=
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 op=3 UNBIND
Dec 15 10:13:27 ldap1 slapd[50625]: conn=12341234 fd=206 closed
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Dec 2014 19:32:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151007#M4592</guid>
      <dc:creator>stefanlasiewski</dc:creator>
      <dc:date>2014-12-15T19:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151008#M4593</link>
      <description>&lt;P&gt;Root cause:&lt;BR /&gt;
The reason this is occurring is because you have 2 key=value pairs with the same key. So Splunk will extract the first value into the key, and then overwrite it with the second value.&lt;/P&gt;

&lt;P&gt;Solution:&lt;BR /&gt;
Define a new field extraction that specifies exactly how you want the fields extracted.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;during the search&lt;/P&gt;

&lt;P&gt;your search ... | rex "from IP=(?P&lt;IP&gt;[^:]+?).*?(IP=(?P&lt;IP_2&gt;[^:])"&lt;/IP_2&gt;&lt;/IP&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;or using the field extraction to create a new field extraction object. You can use the above regex (what is inside the quotes).&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;If you do it this way, you'll get two fields, one called "IP" with the first IP, and another called "IP_2" with the second IP.&lt;/P&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;

&lt;P&gt;--- EDIT ---&lt;/P&gt;

&lt;P&gt;I edited my rex command to stop at the ":"; this is to avoid catching the port in the first IP.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2014 19:41:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151008#M4593</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2014-12-15T19:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151009#M4594</link>
      <description>&lt;P&gt;Thanks. Can you explain what the &lt;CODE&gt;?P&lt;/CODE&gt; does in this regex?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2014 20:52:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151009#M4594</guid>
      <dc:creator>stefanlasiewski</dc:creator>
      <dc:date>2014-12-15T20:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151010#M4595</link>
      <description>&lt;P&gt;It's not necessary, but it's a habit from an older Splunk version. If I remember correctly it used to be needed to specify using "python" regex expressions, indicating that what was coming next (inside the &amp;lt;&amp;gt; brackets) was the name of the field.&lt;/P&gt;

&lt;P&gt;You can simply use &lt;CODE&gt;?&lt;/CODE&gt; instead of &lt;CODE&gt;?P&lt;/CODE&gt; it'll work the same.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2014 21:08:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151010#M4595</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2014-12-15T21:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151011#M4596</link>
      <description>&lt;P&gt;Thanks for your tip about the field extractions. When I try the current regex, I don't get a total match. See &lt;A href="https://www.regex101.com/r/oI7gI2/1"&gt;https://www.regex101.com/r/oI7gI2/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What I settled on was the following: &lt;CODE&gt;from IP=(?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*?\(IP=(?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2014 22:35:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151011#M4596</guid>
      <dc:creator>stefanlasiewski</dc:creator>
      <dc:date>2014-12-15T22:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151012#M4597</link>
      <description>&lt;P&gt;you still need to provide the name of the field after the &lt;CODE&gt;?&lt;/CODE&gt; using these brackets "&amp;lt;" and "&amp;gt;"&lt;/P&gt;</description>
      <pubDate>Tue, 16 Dec 2014 14:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151012#M4597</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2014-12-16T14:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151013#M4598</link>
      <description>&lt;P&gt;Thanks, yes I assigned a name to the field. I just didn't include this in my comment. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 17:47:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151013#M4598</guid>
      <dc:creator>stefanlasiewski</dc:creator>
      <dc:date>2014-12-19T17:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151014#M4599</link>
      <description>&lt;P&gt;If you are using the field name then I don't know why it's not working. Try putting the "P" back in after the "?" in the capture group &lt;CODE&gt;?P&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 19:38:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151014#M4599</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2014-12-19T19:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151015#M4600</link>
      <description>&lt;P&gt;What is the technical difference between &lt;CODE&gt;?P&amp;amp;lt;MyField&amp;amp;gt;&lt;/CODE&gt; and &lt;CODE&gt;?&amp;amp;lt;MyField&amp;amp;gt;&lt;/CODE&gt; without the &lt;CODE&gt;P&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 21:39:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151015#M4600</guid>
      <dc:creator>stefanlasiewski</dc:creator>
      <dc:date>2014-12-19T21:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk creates field from from wrong string in my LDAP logs</title>
      <link>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151016#M4601</link>
      <description>&lt;P&gt;Arg. This software eats the angle bracket characters, and doesn't allow their HTML equivalents.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 21:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-creates-field-from-from-wrong-string-in-my-LDAP-logs/m-p/151016#M4601</guid>
      <dc:creator>stefanlasiewski</dc:creator>
      <dc:date>2014-12-19T21:40:44Z</dc:date>
    </item>
  </channel>
</rss>

