<?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 AD FS ip field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/AD-FS-ip-field-extraction/m-p/405229#M117141</link>
    <description>&lt;P&gt;Stuck on  regex question for Ad FS logs. I am trying to extract all ips following a field ("Client IP: ") in a AD FS log.&lt;BR /&gt;
My log looks like this (truncated to save space):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10/02/2018 09:22:50 AM
LogName=Security
SourceName=AD FS Auditing
EventCode=411
EventType=0
Type=Information
ComputerName=*
User=*
Sid=*
SidType=1
TaskCategory=Printers
OpCode=Info
RecordNumber=*
Keywords=Audit Failure, Classic
Message=Token validation failed. See inner exception for more details. 

Additional Data 

Activity ID: 00000000-0000-0000-0000-000000000000 

Token Type: 
&lt;A href="http://schemas.microsoft.com/ws/2006/05/identitymodel/tokens/UserName" target="test_blank"&gt;http://schemas.microsoft.com/ws/2006/05/identitymodel/tokens/UserName&lt;/A&gt;  

Client IP: 
117.31.21.102,2603:1001:750:16::5 

Error message: 
*****

Exception details: 
System.IdentityModel.Tokens.SecurityTokenValidationException: ******
   at Microsoft.IdentityServer.Service.Tokens.MSISWindowsUserNameSecurityTokenHandler.ValidateToken(SecurityToken token)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the end result desired is that I get both ip addresses under the field src_ip (so it is multivalue), and that it only tries the regex if it finds the EventCode=411 or 512, etc...&lt;/P&gt;

&lt;P&gt;What I have so far is this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?ms)(?:\G(?!\A)\s*,\s*|EventCode=411\R.*?\R)\K(?P&amp;lt;src_ip&amp;gt;(?:\d{1,3}\.){3}(?:\d{1,3})|(?:::)?(?:[\dA-Fa-f]{1,4}:{1,2}){1,7}[\d%A-Fa-f.]*(?:::)?|::[\dA-Fa-f.]{1,15}|::)&lt;/CODE&gt; - which was helpfully provided by someone over at stackoverflow.&lt;/P&gt;

&lt;P&gt;This works in regex101 and any other regex helper sites. However when applied to splunk it only snateches up the first ip.  What am I missing her.  I have tested each individual part independently(as much as I could) and they have worked.&lt;/P&gt;

&lt;P&gt;Is there a problem with negative lookaheads in Splunk?  &lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Tue, 02 Oct 2018 21:33:47 GMT</pubDate>
    <dc:creator>jig004</dc:creator>
    <dc:date>2018-10-02T21:33:47Z</dc:date>
    <item>
      <title>AD FS ip field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/AD-FS-ip-field-extraction/m-p/405229#M117141</link>
      <description>&lt;P&gt;Stuck on  regex question for Ad FS logs. I am trying to extract all ips following a field ("Client IP: ") in a AD FS log.&lt;BR /&gt;
My log looks like this (truncated to save space):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10/02/2018 09:22:50 AM
LogName=Security
SourceName=AD FS Auditing
EventCode=411
EventType=0
Type=Information
ComputerName=*
User=*
Sid=*
SidType=1
TaskCategory=Printers
OpCode=Info
RecordNumber=*
Keywords=Audit Failure, Classic
Message=Token validation failed. See inner exception for more details. 

Additional Data 

Activity ID: 00000000-0000-0000-0000-000000000000 

Token Type: 
&lt;A href="http://schemas.microsoft.com/ws/2006/05/identitymodel/tokens/UserName" target="test_blank"&gt;http://schemas.microsoft.com/ws/2006/05/identitymodel/tokens/UserName&lt;/A&gt;  

Client IP: 
117.31.21.102,2603:1001:750:16::5 

Error message: 
*****

Exception details: 
System.IdentityModel.Tokens.SecurityTokenValidationException: ******
   at Microsoft.IdentityServer.Service.Tokens.MSISWindowsUserNameSecurityTokenHandler.ValidateToken(SecurityToken token)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the end result desired is that I get both ip addresses under the field src_ip (so it is multivalue), and that it only tries the regex if it finds the EventCode=411 or 512, etc...&lt;/P&gt;

&lt;P&gt;What I have so far is this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?ms)(?:\G(?!\A)\s*,\s*|EventCode=411\R.*?\R)\K(?P&amp;lt;src_ip&amp;gt;(?:\d{1,3}\.){3}(?:\d{1,3})|(?:::)?(?:[\dA-Fa-f]{1,4}:{1,2}){1,7}[\d%A-Fa-f.]*(?:::)?|::[\dA-Fa-f.]{1,15}|::)&lt;/CODE&gt; - which was helpfully provided by someone over at stackoverflow.&lt;/P&gt;

&lt;P&gt;This works in regex101 and any other regex helper sites. However when applied to splunk it only snateches up the first ip.  What am I missing her.  I have tested each individual part independently(as much as I could) and they have worked.&lt;/P&gt;

&lt;P&gt;Is there a problem with negative lookaheads in Splunk?  &lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 21:33:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/AD-FS-ip-field-extraction/m-p/405229#M117141</guid>
      <dc:creator>jig004</dc:creator>
      <dc:date>2018-10-02T21:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: AD FS ip field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/AD-FS-ip-field-extraction/m-p/405230#M117142</link>
      <description>&lt;P&gt;Hi @jig004,&lt;/P&gt;

&lt;P&gt;If you have &lt;CODE&gt;Splunk_TA_windows&lt;/CODE&gt; installed on your search head then it will parse &lt;CODE&gt;EventCode&lt;/CODE&gt; field and you will able to use below search to extract IP address. In below query regex which I have provided is based on sample data you have provided if you really want to extract all IPv6 range then you need to change regex accordingly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;yourindex&amp;gt; EventCode=411 OR EventCode=512 | rex field=_raw max_match=0 "(?&amp;lt;IP&amp;gt;(?:\d{1,3}\.){1,3}\d{1,3}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3})"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Oct 2018 14:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/AD-FS-ip-field-extraction/m-p/405230#M117142</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-04T14:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: AD FS ip field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/AD-FS-ip-field-extraction/m-p/405231#M117143</link>
      <description>&lt;P&gt;Did you ever solve this issue?&lt;/P&gt;

&lt;P&gt;I tried using &lt;CODE&gt;| mvexpand src_ip&lt;/CODE&gt;but that didn't grab all of the IP values &lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 16:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/AD-FS-ip-field-extraction/m-p/405231#M117143</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-08-05T16:34:06Z</dc:date>
    </item>
  </channel>
</rss>

