<?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: Help on rex and regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/651929#M225346</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;about the first question: the value to use is already in a field or in raw log?&lt;/P&gt;&lt;P&gt;if in a field you can use:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "(?&amp;lt;exe&amp;gt;\w+\.exe)"&lt;/LI-CODE&gt;&lt;P&gt;if in the raw log, please share a sample of your logs so I can adapt the above regex.&lt;/P&gt;&lt;P&gt;About the second question, please share a sample of your logs.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2023 15:03:59 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-07-25T15:03:59Z</dc:date>
    <item>
      <title>How to extract and filter fields with rex and regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/651927#M225344</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I need help to extract and to filter fields with rex and regex&lt;/P&gt;
&lt;P&gt;1) i need to use a rex field on path wich end by ".exe"&lt;/P&gt;
&lt;P&gt;Example : in path &lt;STRONG&gt;C:\ProgramFiles\Toto\alert.exe&lt;/STRONG&gt; in need to catch "&lt;STRONG&gt;alert.exe&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;2)i need to filter events which have a path in AppData\Roaming and which end by .exe&lt;/P&gt;
&lt;P&gt;I have done this but it doesnt works&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| regex NewProcess=(?i)\\\\AppData\\\\Roaming\\\\[^\\\\]+\\.exe$"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 17:56:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/651927#M225344</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2023-07-31T17:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/651929#M225346</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;about the first question: the value to use is already in a field or in raw log?&lt;/P&gt;&lt;P&gt;if in a field you can use:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "(?&amp;lt;exe&amp;gt;\w+\.exe)"&lt;/LI-CODE&gt;&lt;P&gt;if in the raw log, please share a sample of your logs so I can adapt the above regex.&lt;/P&gt;&lt;P&gt;About the second question, please share a sample of your logs.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 15:03:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/651929#M225346</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-25T15:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652028#M225380</link>
      <description>&lt;P&gt;It works fine for question 1 thanks&lt;/P&gt;&lt;P&gt;For question 2, i need to extract from the field NewProcessName the entire path each time there is AppData\Roaming in the path and whenever the path finish by .exe&lt;/P&gt;&lt;P&gt;Example : NewProcessName="....\....\AppData\Roaming\......\toto.exe"&lt;/P&gt;&lt;P&gt;In this case, i need to catch the entire path&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 10:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652028#M225380</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2023-07-26T10:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652062#M225387</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I need a sample of the raw log to be sure of the regex.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 14:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652062#M225387</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-26T14:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652108#M225398</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Its not a raw log but a simple field which is in reality a path&lt;/P&gt;&lt;P&gt;When there is AppData\Roaming in this field and when this field end path by .exe, i need to catch it in a new path&lt;/P&gt;&lt;P&gt;For example if the field has the syntax below, i need to catch it&lt;/P&gt;&lt;P&gt;"C:\Users\....\AppData\Roaming\....\...\test.exe"&lt;/P&gt;&lt;P&gt;Sorry i cant share a true example due to sensible data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 16:25:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652108#M225398</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2023-07-26T16:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652131#M225410</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you could mask data replacing your words with non sense letters maintaining the same number anf types of chars.&lt;/P&gt;&lt;P&gt;Anyway, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| regex "C:\\Users\\.*\\AppData\\Roaming\\.*\\.*\\\w+.exe"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 18:01:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652131#M225410</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-26T18:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652313#M225459</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;First, if i am not mistaken the diffetence between rex and regex is this one?&lt;/P&gt;&lt;P&gt;" rex will let you extract fields from your data. regex is quite a different thing - it's a search command that uses regular expression syntax to filter search results. It will not extract any fields."&lt;/P&gt;&lt;P&gt;Concernibg my need, i have a field called "NewProcessName" which contains different process path&lt;/P&gt;&lt;P&gt;In this field i need to find the path which contains AppData\\Roaming&lt;/P&gt;&lt;P&gt;So i have done this :&lt;/P&gt;&lt;P&gt;NewProcessName="*\\AppData\\Roaming\\*"&lt;/P&gt;&lt;P&gt;In my stats command, i do a values of this field : | stats values(NewProcessName) as summary&lt;/P&gt;&lt;P&gt;Now from the field summary i need to extract the end of this path which end by ".exe"&lt;/P&gt;&lt;P&gt;So i think i need a rex command to do this&lt;/P&gt;&lt;P&gt;Sorry for my mistake&lt;/P&gt;&lt;P&gt;Could you help please ?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 06:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652313#M225459</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2023-07-28T06:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652354#M225479</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;yes, you're correct: rex extracts fields, regex searches for a string with rules.&lt;/P&gt;&lt;P&gt;If you want to have a statistic for the&amp;nbsp;&lt;SPAN&gt;NewProcessName, you have to extract them and use this new field in the stats command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You have only to understand (this is unoe of the requirements) if you want the full path or a part of it, then you can extract this fields using a regex and use it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;About the question of the search: yes you can search using the asterisks in the end and the beginning but it is less performant than a regex.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope to have helped you, if you nedd help to extract the newProcessname usig a regex, tell me. but if you need the full path you already have it (it's the starting point) if you don't want he full path, please give me the rules.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 10:46:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652354#M225479</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-28T10:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help on rex and regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652432#M225502</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/102660"&gt;@jip31&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2023 05:05:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-filter-fields-with-rex-and-regex/m-p/652432#M225502</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-29T05:05:55Z</dc:date>
    </item>
  </channel>
</rss>

