<?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 grabbing IP from ssh auth log in Security</title>
    <link>https://community.splunk.com/t5/Security/grabbing-IP-from-ssh-auth-log/m-p/110708#M3529</link>
    <description>&lt;P&gt;Hi there, new to splunk.&lt;/P&gt;

&lt;P&gt;I have some records that take two different forms (both denote ssh login failed). I want to make a chart of the top offending remote IP addresses, Can I extract the IP in the same query from these strings even though they have a different number of words preceding it? &lt;/P&gt;

&lt;P&gt;Mar 27 19:45:22 10.20.10.160 Mar 27 19:45:22 monitor-demo sshd[26449]: Failed password for root from 116.10.191.209 port 2024 ssh2&lt;BR /&gt;
Mar 27 19:45:22 10.20.10.160 Mar 27 19:45:22 monitor-demo sshd[26447]: Failed password for invalid user admin from 116.10.191.209 port 2016 ssh2&lt;/P&gt;</description>
    <pubDate>Fri, 28 Mar 2014 08:06:44 GMT</pubDate>
    <dc:creator>kevinlong206</dc:creator>
    <dc:date>2014-03-28T08:06:44Z</dc:date>
    <item>
      <title>grabbing IP from ssh auth log</title>
      <link>https://community.splunk.com/t5/Security/grabbing-IP-from-ssh-auth-log/m-p/110708#M3529</link>
      <description>&lt;P&gt;Hi there, new to splunk.&lt;/P&gt;

&lt;P&gt;I have some records that take two different forms (both denote ssh login failed). I want to make a chart of the top offending remote IP addresses, Can I extract the IP in the same query from these strings even though they have a different number of words preceding it? &lt;/P&gt;

&lt;P&gt;Mar 27 19:45:22 10.20.10.160 Mar 27 19:45:22 monitor-demo sshd[26449]: Failed password for root from 116.10.191.209 port 2024 ssh2&lt;BR /&gt;
Mar 27 19:45:22 10.20.10.160 Mar 27 19:45:22 monitor-demo sshd[26447]: Failed password for invalid user admin from 116.10.191.209 port 2016 ssh2&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 08:06:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/grabbing-IP-from-ssh-auth-log/m-p/110708#M3529</guid>
      <dc:creator>kevinlong206</dc:creator>
      <dc:date>2014-03-28T08:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: grabbing IP from ssh auth log</title>
      <link>https://community.splunk.com/t5/Security/grabbing-IP-from-ssh-auth-log/m-p/110709#M3530</link>
      <description>&lt;P&gt;Hi kevinlong206,&lt;/P&gt;

&lt;P&gt;you can do something like this if the IP is always after &lt;CODE&gt;from&lt;/CODE&gt; and before &lt;CODE&gt;port&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=_raw "from\s(?&amp;lt;theBadGuy&amp;gt;.+)\sport" | ....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or to make sure you only grab numbers&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=_raw "from\s(?&amp;lt;theBadGuy&amp;gt;(\d+\.){3}\d+)\sport" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this will create a new field called &lt;CODE&gt;theBadGuy&lt;/CODE&gt; which can be used further.&lt;/P&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 08:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/grabbing-IP-from-ssh-auth-log/m-p/110709#M3530</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-03-28T08:26:38Z</dc:date>
    </item>
  </channel>
</rss>

