<?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: Search output replicating fields for other fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657093#M226962</link>
    <description>&lt;P&gt;Instead of muscling SPL to give you lots of "OR" expressions (which also slows down performance), it is much more profitable to change your search that will use this token to match distinct values.&lt;/P&gt;&lt;P&gt;First, change $my_token$ definition from a logical expression to simple enumeration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup errorLogs
  | where RunStartTimeStamp == "2023-01-26-15.47.24.000000"
  | where HostName == "myhost.com"
  | where JobName == "runJob1"
  | where InvocationId == "daily"
| eval RunID = coalesce(RunID, ControllingRunID)
| stats values(RunID) as RunID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This gives RunID = ("12345", "67890"). &amp;nbsp;Use this value as $my_token$.&lt;/P&gt;&lt;P&gt;Then, in your search, do the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search setups&amp;gt; (RunID IN ($my_token$) OR ControllingRunID IN ($my_token$))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Sep 2023 21:48:39 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-09-08T21:48:39Z</dc:date>
    <item>
      <title>How to create Search output replicating fields for other fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657091#M226961</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am trying to run a search and have tokens setting various search items, what I need is to create a search from an input file and have one field referenced many times for different fields.&lt;BR /&gt;&lt;BR /&gt;My search is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;| inputlookup errorLogs
  | where RunStartTimeStamp == "2023-01-26-15.47.24.000000"
  | where HostName == "myhost.com"
  | where JobName == "runJob1"
  | where InvocationId == "daily"
  | fields RunID, ControllingRunID 
  | uniq
  | format "(" "(" "OR" ")" "||" ")"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gives:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;( ( ControllingRunID="12345" OR RunID="67890" ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I would like is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;( ( ControllingRunID="12345" OR RunID="67890" 
            OR RunID="12345" OR ControllingRunID="67890") )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There could be many id pairs of run/controlling ID's and I want to search on any combination if possible.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 16:29:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657091#M226961</guid>
      <dc:creator>Cranie</dc:creator>
      <dc:date>2023-09-11T16:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Search output replicating fields for other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657093#M226962</link>
      <description>&lt;P&gt;Instead of muscling SPL to give you lots of "OR" expressions (which also slows down performance), it is much more profitable to change your search that will use this token to match distinct values.&lt;/P&gt;&lt;P&gt;First, change $my_token$ definition from a logical expression to simple enumeration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup errorLogs
  | where RunStartTimeStamp == "2023-01-26-15.47.24.000000"
  | where HostName == "myhost.com"
  | where JobName == "runJob1"
  | where InvocationId == "daily"
| eval RunID = coalesce(RunID, ControllingRunID)
| stats values(RunID) as RunID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This gives RunID = ("12345", "67890"). &amp;nbsp;Use this value as $my_token$.&lt;/P&gt;&lt;P&gt;Then, in your search, do the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search setups&amp;gt; (RunID IN ($my_token$) OR ControllingRunID IN ($my_token$))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 21:48:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657093#M226962</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-09-08T21:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search output replicating fields for other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657106#M226968</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231498"&gt;@Cranie&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if in your events you have one of the two fields RunID, ControllingRunID, you can use&amp;nbsp;the solution from&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;even if you could&amp;nbsp; simplify your token search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup errorLogs WHERE (RunStartTimeStamp == "2023-01-26-15.47.24.000000" AND HostName == "myhost.com" AND JobName == "runJob1" AND InvocationId == "daily") 
| eval RunID = coalesce(RunID, ControllingRunID)
| stats values(RunID) as RunID&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If instead you could have in the same event both the two fields, you should use a more structured search:&lt;/P&gt;&lt;P&gt;in the token:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup errorLogs WHERE (RunStartTimeStamp == "2023-01-26-15.47.24.000000" AND HostName == "myhost.com" AND JobName == "runJob1" AND InvocationId == "daily")
| rename RunID AS token
| fields token
| append [ 
   | inputlookup errorLogs WHERE (RunStartTimeStamp == "2023-01-26-15.47.24.000000" AND HostName == "myhost.com" AND JobName == "runJob1" AND InvocationId == "daily")
   | rename ControllingRunID AS token
   | fields token ]
| dedup token
| fields token&lt;/LI-CODE&gt;&lt;P&gt;and in the search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; (ControllingRunID="$token$" OR RunID="$token$")&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 09 Sep 2023 05:48:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657106#M226968</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-09T05:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Search output replicating fields for other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657160#M226985</link>
      <description>&lt;P&gt;I could not get the solution that&amp;nbsp;&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901" target="_blank"&gt;@yuanliu&lt;/A&gt;&amp;nbsp;gave (in the way I needed).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have managed to get this to work, many many thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 09:22:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657160#M226985</guid>
      <dc:creator>Cranie</dc:creator>
      <dc:date>2023-09-11T09:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search output replicating fields for other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657164#M226986</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231498"&gt;@Cranie&lt;/a&gt;&amp;nbsp;,&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>Mon, 11 Sep 2023 09:37:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657164#M226986</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-11T09:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Search output replicating fields for other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657173#M226987</link>
      <description>&lt;P&gt;Noted - done thanks for the head up.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 10:45:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Search-output-replicating-fields-for-other-fields/m-p/657173#M226987</guid>
      <dc:creator>Cranie</dc:creator>
      <dc:date>2023-09-11T10:45:04Z</dc:date>
    </item>
  </channel>
</rss>

