<?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 to extract the IP and customer_name field from my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244248#M72725</link>
    <description>&lt;P&gt;I tried using extract field from the sample link. It did extract the IP as a field but just the sample one. Not in a way that would give me the list. &lt;BR /&gt;
Also can you tell me how do I undo the extraction? all my search results are now defaulting to this extraction.&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2016 19:33:03 GMT</pubDate>
    <dc:creator>maddy1011</dc:creator>
    <dc:date>2016-05-20T19:33:03Z</dc:date>
    <item>
      <title>How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244245#M72722</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I am trying to extract the IP address that is noted after START: and the customer name. A customer could have multiple IP addresses, so I want to list the all the IPs, customer name, and count for each. &lt;/P&gt;

&lt;P&gt;How do I do that? &lt;/P&gt;

&lt;P&gt;My log looks like this:&lt;/P&gt;

&lt;P&gt;2016-05-09 20:18:05,403 57.0.2 [ttp-bio-942-exec-163] INFO  LoggingFilter -- reqId=234c24a *****************&lt;STRONG&gt;*&amp;gt; START: **10.182.50.95&lt;/STRONG&gt;    /dsg/test-old/v1/testAll    ss=hzufcnfo233rsm897qps&amp;amp;&lt;STRONG&gt;customer_name=abc&lt;/STRONG&gt;&amp;amp;network=fa&amp;amp;view_network=fa&amp;amp;locale=en_US&amp;amp;qa=1&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:40:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244245#M72722</guid>
      <dc:creator>maddy1011</dc:creator>
      <dc:date>2020-09-29T09:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244246#M72723</link>
      <description>&lt;P&gt;Hi @maddy1011,&lt;BR /&gt;
Have you tried using the Field Extractor? Here is some documentation that might help:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.0/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.0/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;We also have some scenario-based documentation that includes a step using the Field Extractor, in case it is helpful.&lt;/P&gt;

&lt;P&gt;Full scenario docs are here:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.0/Scenarios/Goals"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.0/Scenarios/Goals&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And an example of using the Field Extractor for an IP address and username is mentioned here:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.0/Scenarios/Extractfields"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.0/Scenarios/Extractfields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 23:17:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244246#M72723</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2016-05-12T23:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244247#M72724</link>
      <description>&lt;P&gt;in order to help you with the regex you should have provided more than 1 sample &lt;/P&gt;

&lt;P&gt;but this might give you a guidance. it might need  tweak in your environment &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=xyz |rex &amp;amp;customer_name=(?([\S]+))&amp;amp;view  |rex START:\s(?(\d+.\d+.\d+.\d+))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then you will find 2 interesting port  on your left side (interesting fields)  by names  customer_name &amp;amp; IP&lt;/P&gt;

&lt;P&gt;good luck&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 06:11:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244247#M72724</guid>
      <dc:creator>mosman_splunk</dc:creator>
      <dc:date>2016-05-13T06:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244248#M72725</link>
      <description>&lt;P&gt;I tried using extract field from the sample link. It did extract the IP as a field but just the sample one. Not in a way that would give me the list. &lt;BR /&gt;
Also can you tell me how do I undo the extraction? all my search results are now defaulting to this extraction.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 19:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244248#M72725</guid>
      <dc:creator>maddy1011</dc:creator>
      <dc:date>2016-05-20T19:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244249#M72726</link>
      <description>&lt;P&gt;Tried this, did not work, get the below error. (Just tried the rex for IP)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'rex' command: Encountered the following error while compiling the regex 'START:\s(?(\d+.\d+.\d+.\d+))': Regex: assertion expected after (?(
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think I just need the rex for extracting the list for IP, customer_name is an actual field so I could just use that directly. &lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 19:40:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244249#M72726</guid>
      <dc:creator>maddy1011</dc:creator>
      <dc:date>2016-05-20T19:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244250#M72727</link>
      <description>&lt;P&gt;This seems to work, but still working on removing field extraction&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=xyz |rex START:\s(?(\d+.\d+.\d+.\d+))| stats count by IP_add, app|sort -count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 20:20:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244250#M72727</guid>
      <dc:creator>maddy1011</dc:creator>
      <dc:date>2016-05-20T20:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244251#M72728</link>
      <description>&lt;P&gt;Since the row has customer_name=abc, you can actually call for customer_name in the search, and it will include the value.  Splunk is really smart that way.&lt;/P&gt;

&lt;P&gt;As for the IP address, try this regex instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=_raw "(?&amp;lt;ipaddress&amp;gt;(\d{1,3}\.){3}\d{1,3})" |stats COUNT by ipaddress, customer_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The regex looks for 1-3 digits followed by a '.' 3 times, followed by 1-3 digits, and assigns it to a newly created variable called ipaddress.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244251#M72728</guid>
      <dc:creator>drinkingjimmy</dc:creator>
      <dc:date>2020-09-29T09:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244252#M72729</link>
      <description>&lt;P&gt;Hi @maddy1011,&lt;BR /&gt;
This topic:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/Managesearch-timefieldextractions#Delete_field_extractions"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/Managesearch-timefieldextractions#Delete_field_extractions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;has information on deleting a field extraction.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 23:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244252#M72729</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2016-05-20T23:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the IP and customer_name field from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244253#M72730</link>
      <description>&lt;P&gt;I duplicate your example and then changed the IP's and customer names.  The below regex works unless your events change format.   I ran a test with your example data as sometimes the rex does not work the same as regex101.com&lt;/P&gt;

&lt;P&gt;You highlighted "abc" as the customer name.  The Splunk auto extract of the field=value pair does not properly work with your data as demonstrated with the below search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | rex "START\:\s(?((\d{1,3}\.){3}\d{1,3}))\s.*?customer_name\=(?[a-zA-Z\d\s:]+)" | table _time customer_name cust_name ipaddr
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jun 2016 16:06:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-IP-and-customer-name-field-from-my-sample/m-p/244253#M72730</guid>
      <dc:creator>kbrown_splunk</dc:creator>
      <dc:date>2016-06-02T16:06:51Z</dc:date>
    </item>
  </channel>
</rss>

