<?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 eval command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657611#M227141</link>
    <description>&lt;P&gt;I forgotten a pipe before stats&lt;/P&gt;&lt;P&gt;I need to cross the event_file field of the index (called NewProcessName) with the event_file field of the lookup&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2023 13:12:53 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2023-09-14T13:12:53Z</dc:date>
    <item>
      <title>help on eval command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657603#M227134</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;When I run the command below, it works fine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto event_id=4688 |
 eval file_name=if(event_id==4688, replace(NewProcessName, "^*\\\\([^\\\\]+)$","\\1"),null)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I need to combine this search with a subearch&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto event_id=4688 
| eval file_name=if(event_id==4688, replace(NewProcessName, "^*\\\\([^\\\\]+)$","\\1"),null)
[| inputlookup test where software=pm
| table pm
|rename pm as file_name
| format]
| stats values(file_name) as file_name.....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i have the message "Error in "EvalCommand": The expression is malformed&lt;/P&gt;&lt;P&gt;What is wrong please?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 13:13:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657603#M227134</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2023-09-14T13:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657607#M227137</link>
      <description>&lt;P&gt;Remember that subsearches run first and their results become text that replace the subsearch in the query.&amp;nbsp; So, if the subsearch returns "foo.exe" (the value of file_name) then the query becomes&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto event_id=4688 
| eval file_name=if(event_id==4688, replace(NewProcessName, "^*\\\\([^\\\\]+)$","\\1"),null)
foo.exe
stats values(file_name) as file_name.....&lt;/LI-CODE&gt;&lt;P&gt;See the problem?&amp;nbsp; "foo.exe" and the following &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command are considered part of the &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; command because there is no intervening &lt;FONT face="courier new,courier"&gt;|&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;The fix depends on what you want the query to do.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 13:01:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657607#M227137</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-14T13:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657608#M227138</link>
      <description>&lt;P&gt;You can't use subsearches in this way.&lt;/P&gt;&lt;P&gt;What are you trying to achieve?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 13:01:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657608#M227138</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-09-14T13:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657611#M227141</link>
      <description>&lt;P&gt;I forgotten a pipe before stats&lt;/P&gt;&lt;P&gt;I need to cross the event_file field of the index (called NewProcessName) with the event_file field of the lookup&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 13:12:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657611#M227141</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2023-09-14T13:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657620#M227143</link>
      <description>&lt;P&gt;Depending on what you mean by "cross", the search command may do the job.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=toto event_id=4688 
| eval file_name=replace(NewProcessName, "^*\\\\([^\\\\]+)$","\\1")
| search [| inputlookup test where software=pm
  | table pm
  | rename pm as file_name
  | format]
| stats values(file_name) as file_name.....&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 14 Sep 2023 14:09:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657620#M227143</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-14T14:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657640#M227145</link>
      <description>&lt;P&gt;I need to join the file_name field between subsearch and main search&lt;/P&gt;&lt;P&gt;Your example is like what I done but i have an error message like i said in my example&lt;/P&gt;&lt;P&gt;I have also tested to put a rex field just before the stats command, I have no error but also no results even if a common event exists between the main search and the subsearch.....&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=NewProcessName "(?&amp;lt;file_name&amp;gt;\w+\w+\.exe)"
| stats values(file_name) as file_name....&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 14 Sep 2023 15:35:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657640#M227145</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2023-09-14T15:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657649#M227147</link>
      <description>&lt;P&gt;Let's take a step back.&amp;nbsp; What is the desired output of this query?&amp;nbsp; Is it to list the file names that are in both the index and the lookup?&amp;nbsp; Something else?&lt;/P&gt;&lt;P&gt;My latest example is *like* what you've already done, but is different and should have a different result.&amp;nbsp; Have you run it?&amp;nbsp; If so, what is the exact text of the error(s)?&lt;/P&gt;&lt;P&gt;Please eliminate the ellipsis in the &lt;FONT face="courier new,courier"&gt;stats&lt;/FONT&gt; command.&amp;nbsp; The behavior of the command can change depending on the hidden arguments.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 17:03:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-command/m-p/657649#M227147</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-14T17:03:03Z</dc:date>
    </item>
  </channel>
</rss>

