<?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 How to parse wtmp file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162554#M46096</link>
    <description>&lt;P&gt;I am ingesting the non-binary wtmp file in Splunk and was able to two generic fields: 1) priority = auth. (4 unique), and 2) source IP.&lt;/P&gt;

&lt;P&gt;I then broke down each priority to view the unique messages inside each one and identified the relevant messages I'd like to extract fields from. Unfortunately, the format of the file loses its consistency after the ID # auth., where the message starts. What I'd like to extract is the username, but the problem is username is not in the same place in the message for each priority. With that I don't believe there is a generic regex that will capture username, but would to be proven wrong!&lt;/P&gt;

&lt;P&gt;So, digging in more, I flagged the following messages which I'd like to extract the username from (and username always follows "for"):&lt;/P&gt;

&lt;P&gt;Accepted keyboard-interactive   for&lt;BR /&gt;
Accepted password for&lt;BR /&gt;
Failed keyboard-interactive for&lt;BR /&gt;
Failed gssapi-with-mic for&lt;BR /&gt;
Failed password for&lt;BR /&gt;
Failed keyboard-interactive for&lt;BR /&gt;
Failed gssapi-with-mic for&lt;BR /&gt;
Failed publickey for&lt;BR /&gt;
Failed password for&lt;/P&gt;

&lt;P&gt;Moving forward, was trying to figure out the best way to move forward on this. Do I create separate sourcetypes for these specific logs (was going to look to reverse engineer the Symantec for Spunk app as there are multiple sourcetypes defined - I have my SEP logs funneling through the app and it does a good job breaking the logs out, but Symantec's log format is comma deliminated, making it easier), or do I try and create multiple regexes for one sourcetype (is this even possible?)?&lt;/P&gt;

&lt;P&gt;Any ideas would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
    <pubDate>Fri, 19 Dec 2014 19:36:36 GMT</pubDate>
    <dc:creator>jwalzerpitt</dc:creator>
    <dc:date>2014-12-19T19:36:36Z</dc:date>
    <item>
      <title>How to parse wtmp file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162554#M46096</link>
      <description>&lt;P&gt;I am ingesting the non-binary wtmp file in Splunk and was able to two generic fields: 1) priority = auth. (4 unique), and 2) source IP.&lt;/P&gt;

&lt;P&gt;I then broke down each priority to view the unique messages inside each one and identified the relevant messages I'd like to extract fields from. Unfortunately, the format of the file loses its consistency after the ID # auth., where the message starts. What I'd like to extract is the username, but the problem is username is not in the same place in the message for each priority. With that I don't believe there is a generic regex that will capture username, but would to be proven wrong!&lt;/P&gt;

&lt;P&gt;So, digging in more, I flagged the following messages which I'd like to extract the username from (and username always follows "for"):&lt;/P&gt;

&lt;P&gt;Accepted keyboard-interactive   for&lt;BR /&gt;
Accepted password for&lt;BR /&gt;
Failed keyboard-interactive for&lt;BR /&gt;
Failed gssapi-with-mic for&lt;BR /&gt;
Failed password for&lt;BR /&gt;
Failed keyboard-interactive for&lt;BR /&gt;
Failed gssapi-with-mic for&lt;BR /&gt;
Failed publickey for&lt;BR /&gt;
Failed password for&lt;/P&gt;

&lt;P&gt;Moving forward, was trying to figure out the best way to move forward on this. Do I create separate sourcetypes for these specific logs (was going to look to reverse engineer the Symantec for Spunk app as there are multiple sourcetypes defined - I have my SEP logs funneling through the app and it does a good job breaking the logs out, but Symantec's log format is comma deliminated, making it easier), or do I try and create multiple regexes for one sourcetype (is this even possible?)?&lt;/P&gt;

&lt;P&gt;Any ideas would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 19:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162554#M46096</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2014-12-19T19:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse wtmp file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162555#M46097</link>
      <description>&lt;P&gt;It would help to see the raw data, but this should get you started...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=priority " for (?&amp;lt;username&amp;gt;.*?)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Dec 2014 19:41:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162555#M46097</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-12-19T19:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse wtmp file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162556#M46098</link>
      <description>&lt;P&gt;Rich,&lt;/P&gt;

&lt;P&gt;Thx for the reply.&lt;/P&gt;

&lt;P&gt;1) Tried the rex and it's not returning the username field&lt;BR /&gt;
2) Unfortunately, the username doesn't always follow "for" (which adds to the frustration)&lt;BR /&gt;
3) Sample info below:&lt;/P&gt;

&lt;P&gt;Dec 19 14:14:27   sshd[5977]:  [ID 800047 auth.notice] Failed password for root from x.x.x.x port 1055 ssh2&lt;BR /&gt;
Dec 19 14:14:27   sshd[5977]:  [ID 649047 auth.info] AFS Ignoring superuser root&lt;BR /&gt;
Dec 19 14:14:27   sshd[5977]:  [ID 800047 auth.notice] Failed password for root from x.x.x.x port 1055 ssh2&lt;BR /&gt;
Dec 19 14:14:28   sshd[5977]:  [ID 800047 auth.notice] Failed password for root from x.x.x.x port 1055 ssh2&lt;BR /&gt;
Dec 19 14:14:28   sshd[5977]:  [ID 800047 auth.info] Disconnecting: Too many authentication failures for root&lt;BR /&gt;
Dec 19 14:14:28   sshd[5980]:  [ID 800047 auth.info] Illegal user admin from x.x.x.x&lt;BR /&gt;
Dec 19 14:14:28   sshd[5980]:  [ID 800047 auth.info] input_userauth_request: illegal user admin&lt;BR /&gt;
Dec 19 14:14:28   sshd[5980]:  [ID 800047 auth.info] Failed none for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:29   sshd[5983]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:29   sshd[5980]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:29   sshd[5984]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:29   sshd[5980]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:29   sshd[5985]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:29   sshd[5980]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:29   sshd[5986]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:29   sshd[5980]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:30   sshd[5987]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:30   sshd[5980]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:30   sshd[5988]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:30   sshd[5980]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:30   sshd[5980]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 1188 ssh2&lt;BR /&gt;
Dec 19 14:14:30   sshd[5980]:  [ID 800047 auth.info] Disconnecting: Too many authentication failures for admin&lt;BR /&gt;
Dec 19 14:14:33   sshd[5989]:  [ID 800047 auth.info] Illegal user admin from x.x.x.x&lt;BR /&gt;
Dec 19 14:14:33   sshd[5989]:  [ID 800047 auth.info] input_userauth_request: illegal user admin&lt;BR /&gt;
Dec 19 14:14:33   sshd[5989]:  [ID 800047 auth.info] Failed none for  from x.x.x.x port 2441 ssh2&lt;BR /&gt;
Dec 19 14:14:33   sshd[5992]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:33   sshd[5989]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 2441 ssh2&lt;BR /&gt;
Dec 19 14:14:33   sshd[5993]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:33   sshd[5989]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 2441 ssh2&lt;BR /&gt;
Dec 19 14:14:33   sshd[5994]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:33   sshd[5989]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 2441 ssh2&lt;BR /&gt;
Dec 19 14:14:34   sshd[5995]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:34   sshd[5989]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 2441 ssh2&lt;BR /&gt;
Dec 19 14:14:34   sshd[5996]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:34   sshd[5989]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 2441 ssh2&lt;BR /&gt;
Dec 19 14:14:34   sshd[5997]:  [ID 818691 auth.error] AFS Authentication failed for user admin. user doesn't exist&lt;BR /&gt;
Dec 19 14:14:34   sshd[5989]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 2441 ssh2&lt;BR /&gt;
Dec 19 14:14:35   sshd[5989]:  [ID 800047 auth.info] Failed password for  from x.x.x.x port 2441 ssh2&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:29:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162556#M46098</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2020-09-28T18:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse wtmp file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162557#M46099</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex field=priority "(?:for|user|superuser) (?&amp;lt;username&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will return "from" as the user name in the "Failed password" events, however, since that event seem to have no user name in them.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 20:25:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162557#M46099</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-12-19T20:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse wtmp file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162558#M46100</link>
      <description>&lt;P&gt;Improved search when I drop the field=priority. I am seeing unique usernames, but also getting some non-usernames, such as:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Timeout before authentication for x.x.x.x&lt;/LI&gt;
&lt;LI&gt;the word "for"&lt;/LI&gt;
&lt;LI&gt;&lt;/LI&gt;
&lt;LI&gt;log files other than the ones listed in original message:&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Accepted keyboard-interactive for&lt;BR /&gt;
Accepted password for&lt;BR /&gt;
Failed keyboard-interactive for&lt;/P&gt;

&lt;P&gt;That's where the frustration comes in as the regex is getting a majority of the valid usernames, but it's still grabbing some values that aren't usernames.&lt;/P&gt;

&lt;P&gt;And for edification on my part, the ?: is a non-capturing subpattern that is looking for "for|user|superuser" as a starting point, and then matches on everything after up untila nd including the space, correct?&lt;/P&gt;

&lt;P&gt;Thx again&lt;/P&gt;</description>
      <pubDate>Fri, 19 Dec 2014 20:36:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-parse-wtmp-file/m-p/162558#M46100</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2014-12-19T20:36:32Z</dc:date>
    </item>
  </channel>
</rss>

