<?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 Splunk Query in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487392#M8084</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;After Extracting a field using regex. I now need to compare whether that particular field contains any command . Could you please help how to proceed further using eval,match or any other way?&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 10:18:47 GMT</pubDate>
    <dc:creator>rupeshn</dc:creator>
    <dc:date>2019-11-20T10:18:47Z</dc:date>
    <item>
      <title>Splunk Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487392#M8084</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;After Extracting a field using regex. I now need to compare whether that particular field contains any command . Could you please help how to proceed further using eval,match or any other way?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 10:18:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487392#M8084</guid>
      <dc:creator>rupeshn</dc:creator>
      <dc:date>2019-11-20T10:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487393#M8085</link>
      <description>&lt;P&gt;Hi @rupeshn,&lt;BR /&gt;
Try below-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval matches = if(match(fieldname,"command Line"), 1, 0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If it find command line in fieldname then it will return 1 else 0&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 10:24:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487393#M8085</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2019-11-20T10:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487394#M8086</link>
      <description>&lt;P&gt;That can be any command. Can i write a regex for command in place of "command line". If yes, Could you please suggest.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 10:28:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487394#M8086</guid>
      <dc:creator>rupeshn</dc:creator>
      <dc:date>2019-11-20T10:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487395#M8087</link>
      <description>&lt;P&gt;Please provide more details on sample data and what output are you expecting&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 10:39:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487395#M8087</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2019-11-20T10:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487396#M8088</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You could write the regex to match the field values to capture the commands in your newly extracted field. See below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval commands="vi,cd,hello,world"
| makemv delim="," commands
| mvexpand commands
| rex field=commands "(?&amp;lt;abc&amp;gt;.*)"
| eval contains_command=if(match(abc,"vi|cd"),"Yes","No")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here I have extracted field &lt;CODE&gt;abc&lt;/CODE&gt; from field &lt;CODE&gt;commands&lt;/CODE&gt; and then I used eval and simple regex using &lt;CODE&gt;match&lt;/CODE&gt; function to identify the commands in field &lt;CODE&gt;abc&lt;/CODE&gt;&lt;BR /&gt;
If it's there then I will see result as yes and no respectively. &lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 11:48:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Query/m-p/487396#M8088</guid>
      <dc:creator>sanjeev543</dc:creator>
      <dc:date>2019-11-20T11:48:56Z</dc:date>
    </item>
  </channel>
</rss>

