<?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 generate the regex to extract distinct values of this field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465042#M131035</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;You can try this regex &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex field=WindowsIdentity "(?&amp;lt;yourNewField&amp;gt;[\w\.]+)\.monster"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This is an example :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval WindowsIdentity = "IIS APPPOOL\ jobs.monster.com"
| rex field=WindowsIdentity "(?&amp;lt;yourNewField&amp;gt;\w+)\.monster"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 Aug 2019 11:28:37 GMT</pubDate>
    <dc:creator>KailA</dc:creator>
    <dc:date>2019-08-28T11:28:37Z</dc:date>
    <item>
      <title>How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465041#M131034</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have events with the field WindowsIdentity. Some examples of this field values are:&lt;/P&gt;

&lt;P&gt;WindowsIdentity: IIS APPPOOL\login20.monster.com&lt;BR /&gt;
IIS APPPOOL\ &lt;STRONG&gt;jobs&lt;/STRONG&gt;.monster.com&lt;BR /&gt;
 IIS APPPOOL\ &lt;STRONG&gt;hiring.channels&lt;/STRONG&gt;.monster.com_jcm&lt;BR /&gt;
 IIS APPPOOL\ &lt;STRONG&gt;wwwcs.channels&lt;/STRONG&gt;.monster.com&lt;/P&gt;

&lt;P&gt;I tried extracting it with the IFX and I used it like this: rex field=WindowsIdentity "(?P\w+)"  but it extracts IIS instead of the text highlighted in bold?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 07:19:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465041#M131034</guid>
      <dc:creator>lsy9891</dc:creator>
      <dc:date>2019-08-28T07:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465042#M131035</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;You can try this regex &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex field=WindowsIdentity "(?&amp;lt;yourNewField&amp;gt;[\w\.]+)\.monster"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This is an example :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval WindowsIdentity = "IIS APPPOOL\ jobs.monster.com"
| rex field=WindowsIdentity "(?&amp;lt;yourNewField&amp;gt;\w+)\.monster"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Aug 2019 11:28:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465042#M131035</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2019-08-28T11:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465043#M131036</link>
      <description>&lt;P&gt;Hi, the rex command extracted some important info from the URL. For example, &lt;/P&gt;

&lt;P&gt;IIS&amp;nbsp;APPPOOL\career-advice.monster.com  should be extracted to career-advice and not channels. Basically, anything that's between \ and monster.com. How should I fix that? &lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 02:34:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465043#M131036</guid>
      <dc:creator>lsy9891</dc:creator>
      <dc:date>2019-08-29T02:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465044#M131037</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; | rex field=WindowsIdentity "IIS APPPOOL\\(?P&amp;lt;yourNewField&amp;gt;[.\w]+).monster"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Aug 2019 03:27:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465044#M131037</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2019-08-29T03:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465045#M131038</link>
      <description>&lt;P&gt;I got Error in 'rex' command: Encountered the following error while compiling the regex 'IIS APPPOOL(?P[.\w]+).monster': Regex: unmatched closing parenthesis&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 05:26:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465045#M131038</guid>
      <dc:creator>lsy9891</dc:creator>
      <dc:date>2019-08-29T05:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465046#M131039</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;This regex is a bit greedy but its doing exactly what you ask:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
 | eval WindowsIdentity = "IIS APPPOOL\career-advice.monster.com"
 | rex field=WindowsIdentity "\\\\(?&amp;lt;yourNewField&amp;gt;.*)\.monster"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need another regex that is a bit more safe you can use this one :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval WindowsIdentity = "IIS APPPOOL\career-advice.monster.com"
| rex field=WindowsIdentity "\\\\(?&amp;lt;yourNewField&amp;gt;[\w\-\.]+)\.monster"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And if it's not matching a particular character you can add it to this part &lt;CODE&gt;[\w\-\.]+&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 08:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465046#M131039</guid>
      <dc:creator>KailA</dc:creator>
      <dc:date>2019-08-29T08:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465047#M131040</link>
      <description>&lt;P&gt;Yep.  I like @KailA 's last one best.  I'm suffering from \\ (backslash-backslash) whiplash.  &lt;span class="lia-unicode-emoji" title=":monkey_face:"&gt;🐵&lt;/span&gt;  Suggest letting &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; help you get to the end of it.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 12:04:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465047#M131040</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2019-08-29T12:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate the regex to extract distinct values of this field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465048#M131041</link>
      <description>&lt;P&gt;I'm not entirely clear how your messages are actually formatted - is "WindowsIdentity" the name of the field and also part of the field? are all these lines part of the same message and you want to skip the first value - "WindowsIdentity: IIS APPPOOL\login20.monster.com"?&lt;/P&gt;

&lt;P&gt;Maybe this will work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{ ... base search ... }
| rex max_match=100 field=WindowsIdentity "IIS APPPOOL\\\+\s?(?&amp;lt;App&amp;gt;.*?)\.monster\.com"
| eval app_count=mvcount(App) | eval App=mvindex(App,1,app_count)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Aug 2019 13:07:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-generate-the-regex-to-extract-distinct-values-of-this/m-p/465048#M131041</guid>
      <dc:creator>wenthold</dc:creator>
      <dc:date>2019-08-29T13:07:10Z</dc:date>
    </item>
  </channel>
</rss>

