<?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 can i use rex to match multiple keywords in a file name in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91518#M23570</link>
    <description>&lt;P&gt;If you extract the &lt;CODE&gt;found_project&lt;/CODE&gt; field and &lt;CODE&gt;project_plan.doc&lt;/CODE&gt; is one of the values for that field. The match will exclude any events that do not match the keyword, other than that I'm not sure I understand the question...&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2012 15:06:54 GMT</pubDate>
    <dc:creator>MHibbin</dc:creator>
    <dc:date>2012-10-17T15:06:54Z</dc:date>
    <item>
      <title>how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91515#M23567</link>
      <description>&lt;P&gt;i have key words like project, plan ,lease &lt;BR /&gt;
now if any file name if these key word hits i need to find which keywords have hitted. if my file mane is Project_plan gamil.doc then keywords hitted are project and plan.&lt;BR /&gt;
MY query is like&lt;/P&gt;

&lt;P&gt;mysearch | rex field=source "(?&lt;FOUND_PROJECT&gt;(?i)(project))" | table _time found_project source _raw &lt;BR /&gt;
 but when i am writing like&lt;/FOUND_PROJECT&gt;&lt;/P&gt;

&lt;P&gt;mysearch | rex field=source "(?&lt;FOUND_PROJECT&gt;(?i)(project|plan|lease))" | table _time found_project source _raw &lt;BR /&gt;
its not working as the column found_project is only containing Plan or project not those two field together for Project_plan gamil.doc but i want my found_project column contain data like Project,plan &lt;BR /&gt;
as two key words have been hit.&lt;/FOUND_PROJECT&gt;&lt;/P&gt;

&lt;P&gt;In java scripts there is one coomand a=string.match(regex);a cloumn will contain all the data that match with regex.I want to do the same with splunk. Can anyone help in this regards. &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:37:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91515#M23567</guid>
      <dc:creator>Tridi123</dc:creator>
      <dc:date>2020-09-28T12:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91516#M23568</link>
      <description>&lt;P&gt;You could try the following:&lt;/P&gt;

&lt;P&gt;Define your rex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch | rex field=source "(?&amp;lt;found_project&amp;gt;(?i)(project))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Create a "match" field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..| eval match=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Create a lookup with your keywords and the match column, e.g. for keywords.csv (this will need to be set up on server side):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;match,keyword
1,plan
1,lease
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've taken project out as you have already extracted this in the field, so you could always add it back in as another row.&lt;/P&gt;

&lt;P&gt;Perform a lookup on the match field to add in your values:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..|lookup keywords match output keyword
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should add all the values to your events, so expand them out:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..|mvexpand keyword
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then filter out any matching events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..| where match(keyword,found_project)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have not tested this, but I have used similar solutions before when looking for keywords.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2012 12:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91516#M23568</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-10-16T12:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91517#M23569</link>
      <description>&lt;P&gt;in which way i will pass the file name&lt;BR /&gt;
Project_plan.doc because i have to match with filename whether this key words are present in file name or not to lookup query?Can u help once more please&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2012 11:47:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91517#M23569</guid>
      <dc:creator>Tridi123</dc:creator>
      <dc:date>2012-10-17T11:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91518#M23570</link>
      <description>&lt;P&gt;If you extract the &lt;CODE&gt;found_project&lt;/CODE&gt; field and &lt;CODE&gt;project_plan.doc&lt;/CODE&gt; is one of the values for that field. The match will exclude any events that do not match the keyword, other than that I'm not sure I understand the question...&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2012 15:06:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91518#M23570</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-10-17T15:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91519#M23571</link>
      <description>&lt;P&gt;Doesn't using max_match do the trick?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fields source | rex field=file max_match=999999 "(?&amp;lt;found_project&amp;gt;(?i)(project|plan|lease|someotherterm))" | table _time found_project source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="http://splunk-base.splunk.com//storage/screenshot.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2012 15:49:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91519#M23571</guid>
      <dc:creator>ayme</dc:creator>
      <dc:date>2012-10-17T15:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91520#M23572</link>
      <description>&lt;P&gt;if my file name is project_plan_project.doc&lt;BR /&gt;
then under found project plan is coming twice like&lt;BR /&gt;
Plan&lt;BR /&gt;
Project&lt;BR /&gt;
project&lt;/P&gt;

&lt;P&gt;Is there any slution so that project come only once i used dedup but it wont wok. Can u help me?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:39:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91520#M23572</guid>
      <dc:creator>Tridi123</dc:creator>
      <dc:date>2020-09-28T12:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91521#M23573</link>
      <description>&lt;P&gt;... | fields source | rex field=file max_match=999999 "(?&lt;FOUND_PROJECT&gt;(?i)(project|plan|lease|someotherterm))" | table _time found_project source | mvexpand found_project | dedup found_project, source&lt;/FOUND_PROJECT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:39:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91521#M23573</guid>
      <dc:creator>ayme</dc:creator>
      <dc:date>2020-09-28T12:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91522#M23574</link>
      <description>&lt;P&gt;thjanks for ur help.I thought about mv expand but it was coming as&lt;/P&gt;

&lt;P&gt;project_plan_project.doc  project&lt;/P&gt;

&lt;P&gt;project_plan_project.doc  plan&lt;/P&gt;

&lt;P&gt;but my final table will be like&lt;/P&gt;

&lt;P&gt;project_plan_project.doc  project&lt;BR /&gt;
                          plan &lt;/P&gt;

&lt;P&gt;that is found_project at last will be multivalued filed &lt;BR /&gt;
only project will come once.&lt;BR /&gt;
Is there any query in Splunk for this ?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:39:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91522#M23574</guid>
      <dc:creator>Tridi123</dc:creator>
      <dc:date>2020-09-28T12:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91523#M23575</link>
      <description>&lt;P&gt;project_plan_project.doc                       project&lt;BR /&gt;
                                                plan&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:39:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91523#M23575</guid>
      <dc:creator>Tridi123</dc:creator>
      <dc:date>2020-09-28T12:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: how can i use rex to match multiple keywords in a file name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91524#M23576</link>
      <description>&lt;P&gt;can nomv help on this requirement??&lt;/P&gt;</description>
      <pubDate>Sat, 20 Oct 2012 08:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-i-use-rex-to-match-multiple-keywords-in-a-file-name/m-p/91524#M23576</guid>
      <dc:creator>Tridi123</dc:creator>
      <dc:date>2012-10-20T08:16:18Z</dc:date>
    </item>
  </channel>
</rss>

