<?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 to rename fields when using 2 queries with OR in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708320#M239545</link>
    <description>&lt;P&gt;Please do not use screenshot to illustrate text data. &amp;nbsp;Use text table or text box. &amp;nbsp;But even the two index search screenshots are inconsistent, meaning there is no common dest_ip. &amp;nbsp;You cannot expect all fields to be populated when there is no matching field value. &amp;nbsp;This is basic mathematics.&lt;/P&gt;&lt;P&gt;Like &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;says, find a small number of events that you know have matching dest_ip in both indices, manually calculate what the output should be, then use the proposed searches on this small dataset.&lt;/P&gt;&lt;P&gt;Here is a mock dataset losely based on your screenshots but WITH matching dest_ip&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;src_zone&lt;/TD&gt;&lt;TD&gt;src_ip&lt;/TD&gt;&lt;TD&gt;dest_zone&lt;/TD&gt;&lt;TD&gt;dest_ip&lt;/TD&gt;&lt;TD&gt;transport&lt;/TD&gt;&lt;TD&gt;dest_port&lt;/TD&gt;&lt;TD&gt;app&lt;/TD&gt;&lt;TD&gt;rule&lt;/TD&gt;&lt;TD&gt;action&lt;/TD&gt;&lt;TD&gt;session_end_reason&lt;/TD&gt;&lt;TD&gt;packets_out&lt;/TD&gt;&lt;TD&gt;packets_in&lt;/TD&gt;&lt;TD&gt;src_translated_ip&lt;/TD&gt;&lt;TD&gt;dvc_name&lt;/TD&gt;&lt;TD&gt;index&lt;/TD&gt;&lt;TD&gt;server_name&lt;/TD&gt;&lt;T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;&lt;TD&gt;idon'tcare&lt;/TD&gt;&lt;TD&gt;TLSv3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;The first row is from index=*firewall*, the second from&amp;nbsp;*corelight*.&lt;/P&gt;&lt;P&gt;Because your two searches operators on different indices,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;'s search can also be expressed with append (as opposed to OR) without much penalty. &amp;nbsp;Like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="*firewall*" sourcetype=*traffic* src_ip=10.0.0.0/8
| append
    [search index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*]
| fields src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| stats values(*) AS * BY dest_ip
| rename src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, server_name AS SNI, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the mock dataset, the output is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Destination&lt;/TD&gt;&lt;TD&gt;Action&lt;/TD&gt;&lt;TD&gt;Application&lt;/TD&gt;&lt;TD&gt;DC&lt;/TD&gt;&lt;TD&gt;Egress IP&lt;/TD&gt;&lt;TD&gt;End Reason&lt;/TD&gt;&lt;TD&gt;From&lt;/TD&gt;&lt;TD&gt;Packets In&lt;/TD&gt;&lt;TD&gt;Packets Out&lt;/TD&gt;&lt;TD&gt;Port&lt;/TD&gt;&lt;TD&gt;Protocol&lt;/TD&gt;&lt;TD&gt;Rule&lt;/TD&gt;&lt;TD&gt;SNI&lt;/TD&gt;&lt;TD&gt;Source&lt;/TD&gt;&lt;TD&gt;To&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;152.88.1.76&lt;/TD&gt;&lt;TD&gt;blocked&lt;/TD&gt;&lt;TD&gt;dns_base&lt;/TD&gt;&lt;TD&gt;don'tmatter&lt;/TD&gt;&lt;TD&gt;whateverNAT&lt;/TD&gt;&lt;TD&gt;policy_deny&lt;/TD&gt;&lt;TD&gt;trusted&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;TD&gt;UDP&lt;/TD&gt;&lt;TD&gt;whatever1&lt;/TD&gt;&lt;TD&gt;whatever2&lt;/TD&gt;&lt;TD&gt;10.80.110.8&lt;/TD&gt;&lt;TD&gt;untrusted&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This is a full emulation for you to play with and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="src_zone, src_ip, dest_zone, dest_ip, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
trusted, 10.80.110.8, untrusted, 152.88.1.76, UDP, 53, dns_base, whatever1, blocked, policy_deny, 1, 0, whateverNAT, don'tmatter"
| table src_zone, src_ip, dest_zone, dest_ip, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| eval index="*firewall*"
``` the above emulates
index="*firewall*" sourcetype=*traffic* src_ip=10.0.0.0/8
```
| append
    [makeresults format=csv data="server_name, dest_ip, ssl_version, ssl_cipher
    whatever2, 152.88.1.76, TLSv3, idon'tcare"
    | eval index="*corelight*"
    ``` the above emulates
    index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*
    ```]
| fields src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| stats values(*) AS * BY dest_ip
| rename src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, server_name AS SNI, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2025 07:50:02 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2025-01-09T07:50:02Z</dc:date>
    <item>
      <title>How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708161#M239483</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have 2 queries where indices are different and have a common field &lt;FONT face="courier new,courier"&gt;dest_ip &lt;FONT face="arial,helvetica,sans-serif"&gt;which is my focus&lt;/FONT&gt;(&lt;FONT face="arial,helvetica,sans-serif"&gt;same field name in both indices). Please note that t&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;here are also some other common fields such as &lt;FONT face="courier new,courier"&gt;src_ip, action&lt;/FONT&gt; etc.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Query 1:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*corelight* sourcetype=*corelight* server_name="*microsoft.com*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;additional fields: &lt;FONT face="courier new,courier"&gt;&lt;EM&gt;action, ssl_version, ssl_cipher&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Query 2:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="*firewall*" sourcetype=*traffic* src_ip=10.1.1.100 &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;additional fields:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;EM&gt;_time,&amp;nbsp;src_zone, src_ip, dest_zone, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I'm trying to output all the corresponding server_names for each dest_ip, as a table with all the listed fields from both query outputs&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to Splunk and learning my way; I've tried the following so far -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A)&amp;nbsp;using join (which is usually very slow and sometimes doesn't give me a result)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*
| join dest_ip 
[ search index="*firewall*" sourcetype=*traffic* src_ip=10.1.1.100 | fields src_ip, src_user, dest_ip, rule, action, app, transport, version, session_end_reason, dvc_name, bytes_out ] 
| dedup server_name
| table _time, src_ip, dest_ip, transport, dest_port, app, rule, server_name, action, session_end_reason, dvc_name 
| rename _time as "timestamp", transport as "protocol"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b)&lt;/P&gt;&lt;P&gt;using an OR&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*) OR (index="*firewall*" sourcetype=*traffic* src_ip=10.1.1.100)
| dedup src_ip, dest_ip
| table src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| rename src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, server_name AS SNI, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC"&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;My questions -&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Would you suggest a better way to write/construct my above queries?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;In my OR output, I only see a couple of columns populating values (eg.&amp;nbsp;&lt;FONT face="courier new,courier"&gt;src_ip, dest_ip, action&lt;/FONT&gt;) while the rest are empty. My guess is they're populating because I'm doing an inner join and these are the common fields between the two.&lt;UL&gt;&lt;LI&gt;Since I'm unable to populate the others, maybe I need to do a left join?&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Can you kindly guide me on how to rename fields specific to each index when combining queries using OR?&amp;nbsp;I've tried a few times but haven't been successful&lt;UL&gt;&lt;LI&gt;For example, in my above OR statement - how and where in the query do I rename the field &lt;FONT face="courier new,courier"&gt;ssl_cipher&lt;/FONT&gt; in index=*corelight* to &lt;FONT face="courier new,courier"&gt;ENCRYPT_ALGORITHM&lt;/FONT&gt;?&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 16:40:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708161#M239483</guid>
      <dc:creator>sdcig</dc:creator>
      <dc:date>2025-01-07T16:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708162#M239484</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/275293"&gt;@sdcig&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;as you experienced, don't use join because it's very slow!&lt;/P&gt;&lt;P&gt;use the OR conditions correlated using stats, something like this to adapt to your requirements:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*) OR (index="*firewall*" sourcetype=*traffic* src_ip=10.1.1.100)
| dedup src_ip, dest_ip
| fields src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| stats values(*) AS * BY dest_ip
| rename src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, server_name AS SNI, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC"&lt;/LI-CODE&gt;&lt;P&gt;If possible, try to avoid to use asterisk at the beginning of a string (as in your case in index, sourcetype and host).&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 16:40:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708162#M239484</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-01-07T16:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708165#M239486</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;for your response and guidance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your query and it's giving me results, however it's only populating 5 fields which are ones that are common to both indices.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do you suggest I modify the query so the output also displays all the following fields that are under&amp;nbsp;&lt;FONT face="courier new,courier"&gt;index="*firewall*"?&lt;/FONT&gt;&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;src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My intent is to display the data in the following order (that includes fields from both indices) if possible -&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#FF0000"&gt;***specific fields from index=corelight are in &lt;STRONG&gt;bold&lt;/STRONG&gt; for reference&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, &lt;STRONG&gt;server_name AS SNI&lt;/STRONG&gt;, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC",&amp;nbsp;&lt;STRONG&gt;ssl_version AS Version&lt;/STRONG&gt;, &lt;STRONG&gt;ssl_cipher AS ENCRPT_ALGO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 17:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708165#M239486</guid>
      <dc:creator>sdcig</dc:creator>
      <dc:date>2025-01-07T17:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708233#M239513</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/275293"&gt;@sdcig&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I simplified the search, in the stats command replace the values(*) As * with the five fields you want:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*) OR (index="*firewall*" sourcetype=*traffic* src_ip=10.1.1.100)
| dedup src_ip, dest_ip
| fields src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| stats 
     values(src_zone) AS From
     values(src_ip) AS Source,
     values(dest_zone) AS To
     values(server_name) AS SNI
     values(transport) AS Protocol
     values(dest_port) AS Port
     values(app) AS Application
     values(rule) AS Rule
     values(action) AS Action
     values(session_end_reason) AS "End Reason"
     values(packets_out) AS "Packets Out"
     values(packets_in) AS "Packets In"
     values(src_translated_ip) AS "Egress IP"
     values(dvc_name) AS DC
     values(src_zone) AS src_zone
     BY dest_ip
| rename dest_ip AS Destination&lt;/LI-CODE&gt;&lt;P&gt;if there are fields with different names between the two indexes, use eval coalesce to have the same field name.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 07:54:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708233#M239513</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-01-08T07:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708236#M239515</link>
      <description>&lt;P&gt;When using OR, you cannot dedup src_ip dest_ip immediately after search. &amp;nbsp;That should be performed after stats, like what you do with join.&lt;/P&gt;&lt;P&gt;Using the same structure&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;proposed, you can do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*) OR (index="*firewall*" sourcetype=*traffic* src_ip=10.1.1.100)
| fields src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| stats values(*) AS * BY dest_ip
| dedup src_ip, dest_ip ``` most likely this is unnecessary after stats ```
| rename src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, server_name AS SNI, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 08:08:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708236#M239515</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-01-08T08:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708238#M239517</link>
      <description>&lt;P&gt;Just a note on your use of dedup, you will only end up with a single event from ONE of the indexes (whichever is found first), which is one of the reasons why your search is not working as expected.&lt;/P&gt;&lt;P&gt;You COULD use&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| dedup index src_ip dest_ip&lt;/LI-CODE&gt;&lt;P&gt;which would leave you one event from EACH index, however, as&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;has said, fields + stats + rename is generally the optimal way to do the grouping.&lt;/P&gt;&lt;P&gt;However, consider what exactly do you want to see in the other fields, using dedup would only give you ONE value from the event that remains after the dedup, but the &lt;STRONG&gt;stats values(*) as *&amp;nbsp;&lt;/STRONG&gt;would give you all values from all events for each of the src_ip grouping.&lt;/P&gt;&lt;P&gt;Avoid&amp;nbsp;&lt;STRONG&gt;join&lt;/STRONG&gt; - it's not a Splunk way to do things, has significant limitations and will silently discard data leading to variable results.&amp;nbsp;&lt;STRONG&gt;stats&amp;nbsp;&lt;/STRONG&gt;is always the way to join data sets.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 08:30:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708238#M239517</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2025-01-08T08:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708285#M239531</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;for your help and input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing I'm still missing is being able to populate values in all the fields listed. Let me explain with some screenshots for better context -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output of just corelight query shows values for the fields -&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-01-08_12-48-48_splunk_cl.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/34071i204F4EEB2F2EBF85/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-01-08_12-48-48_splunk_cl.png" alt="2025-01-08_12-48-48_splunk_cl.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output of just the firewall query shows values for all related fields -&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-01-08_12-48-48_splunk_fw.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/34070i96B1154822C395B6/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-01-08_12-48-48_splunk_fw.png" alt="2025-01-08_12-48-48_splunk_fw.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the output of the suggested OR queries does not populate the values of many of the fields (highlighted in red)-&lt;/P&gt;&lt;P&gt;eg (1).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-01-08_12-48-48_splunk_or.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/34073i851BA718153C1B91/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-01-08_12-48-48_splunk_or.png" alt="2025-01-08_12-48-48_splunk_or.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg (2).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only see 5 values when using stats values (*) by * in the OR query (seems like it's just the fields that are common to both indices and none of others listed will be displayed?)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2025-01-08_12-48-48_splunk_or_values.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/34072iE7DB822BC94BACCA/image-size/large?v=v2&amp;amp;px=999" role="button" title="2025-01-08_12-48-48_splunk_or_values.png" alt="2025-01-08_12-48-48_splunk_or_values.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 18:28:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708285#M239531</guid>
      <dc:creator>sdcig</dc:creator>
      <dc:date>2025-01-08T18:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708293#M239533</link>
      <description>&lt;P&gt;All fields should be there if those contains some values.&lt;BR /&gt;You could debug it e.g.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;comment dedup away&lt;/LI&gt;&lt;LI&gt;comment stats away and replace it with table&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Also if/when you are using verbose mode you can see what values you have in Events tab. With Smart or Fast mode this tab is not available.&lt;/P&gt;&lt;P&gt;r Ismo&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 20:29:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708293#M239533</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2025-01-08T20:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708312#M239541</link>
      <description>&lt;P&gt;Example 1 - you are using dedup src/dest - you can't do that as I explained in my other post.&lt;/P&gt;&lt;P&gt;Example 2 - dedup here is not useful - you have a multivalue src_ip and you will not have any duplicate src_ip in there relating to the dest_ip, so it's redundant. Best way to work out what's wrong here is to remove the last 2 lines and just let the stats work.&lt;/P&gt;&lt;P&gt;If you work on a small time zone where you KNOW what data you expect - then you can more easily validate what's wrong. As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;says, you can even remove stats and just to table * - but work with a very small data set where the results are predictable.&lt;/P&gt;&lt;P&gt;Then you can build back the detail again.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 22:49:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708312#M239541</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2025-01-08T22:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to rename fields when using 2 queries with OR</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708320#M239545</link>
      <description>&lt;P&gt;Please do not use screenshot to illustrate text data. &amp;nbsp;Use text table or text box. &amp;nbsp;But even the two index search screenshots are inconsistent, meaning there is no common dest_ip. &amp;nbsp;You cannot expect all fields to be populated when there is no matching field value. &amp;nbsp;This is basic mathematics.&lt;/P&gt;&lt;P&gt;Like &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;says, find a small number of events that you know have matching dest_ip in both indices, manually calculate what the output should be, then use the proposed searches on this small dataset.&lt;/P&gt;&lt;P&gt;Here is a mock dataset losely based on your screenshots but WITH matching dest_ip&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;src_zone&lt;/TD&gt;&lt;TD&gt;src_ip&lt;/TD&gt;&lt;TD&gt;dest_zone&lt;/TD&gt;&lt;TD&gt;dest_ip&lt;/TD&gt;&lt;TD&gt;transport&lt;/TD&gt;&lt;TD&gt;dest_port&lt;/TD&gt;&lt;TD&gt;app&lt;/TD&gt;&lt;TD&gt;rule&lt;/TD&gt;&lt;TD&gt;action&lt;/TD&gt;&lt;TD&gt;session_end_reason&lt;/TD&gt;&lt;TD&gt;packets_out&lt;/TD&gt;&lt;TD&gt;packets_in&lt;/TD&gt;&lt;TD&gt;src_translated_ip&lt;/TD&gt;&lt;TD&gt;dvc_name&lt;/TD&gt;&lt;TD&gt;index&lt;/TD&gt;&lt;TD&gt;server_name&lt;/TD&gt;&lt;TD&gt;ssl_cipher&lt;/TD&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;/TD&gt;&lt;TD&gt;TLSv3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;The first row is from index=*firewall*, the second from&amp;nbsp;*corelight*.&lt;/P&gt;&lt;P&gt;Because your two searches operators on different indices,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;'s search can also be expressed with append (as opposed to OR) without much penalty. &amp;nbsp;Like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="*firewall*" sourcetype=*traffic* src_ip=10.0.0.0/8
| append
    [search index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*]
| fields src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| stats values(*) AS * BY dest_ip
| rename src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, server_name AS SNI, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the mock dataset, the output is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Destination&lt;/TD&gt;&lt;TD&gt;Action&lt;/TD&gt;&lt;TD&gt;Application&lt;/TD&gt;&lt;TD&gt;DC&lt;/TD&gt;&lt;TD&gt;Egress IP&lt;/TD&gt;&lt;TD&gt;End Reason&lt;/TD&gt;&lt;TD&gt;From&lt;/TD&gt;&lt;TD&gt;Packets In&lt;/TD&gt;&lt;TD&gt;Packets Out&lt;/TD&gt;&lt;TD&gt;Port&lt;/TD&gt;&lt;TD&gt;Protocol&lt;/TD&gt;&lt;TD&gt;Rule&lt;/TD&gt;&lt;TD&gt;SNI&lt;/TD&gt;&lt;TD&gt;Source&lt;/TD&gt;&lt;TD&gt;To&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;152.88.1.76&lt;/TD&gt;&lt;TD&gt;blocked&lt;/TD&gt;&lt;TD&gt;dns_base&lt;/TD&gt;&lt;TD&gt;don'tmatter&lt;/TD&gt;&lt;TD&gt;whateverNAT&lt;/TD&gt;&lt;TD&gt;policy_deny&lt;/TD&gt;&lt;TD&gt;trusted&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;TD&gt;UDP&lt;/TD&gt;&lt;TD&gt;whatever1&lt;/TD&gt;&lt;TD&gt;whatever2&lt;/TD&gt;&lt;TD&gt;10.80.110.8&lt;/TD&gt;&lt;TD&gt;untrusted&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This is a full emulation for you to play with and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="src_zone, src_ip, dest_zone, dest_ip, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
trusted, 10.80.110.8, untrusted, 152.88.1.76, UDP, 53, dns_base, whatever1, blocked, policy_deny, 1, 0, whateverNAT, don'tmatter"
| table src_zone, src_ip, dest_zone, dest_ip, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| eval index="*firewall*"
``` the above emulates
index="*firewall*" sourcetype=*traffic* src_ip=10.0.0.0/8
```
| append
    [makeresults format=csv data="server_name, dest_ip, ssl_version, ssl_cipher
    whatever2, 152.88.1.76, TLSv3, idon'tcare"
    | eval index="*corelight*"
    ``` the above emulates
    index=*corelight* sourcetype=*corelight* server_name=*microsoft.com*
    ```]
| fields src_zone, src_ip, dest_zone, dest_ip, server_name, transport, dest_port, app, rule, action, session_end_reason, packets_out, packets_in, src_translated_ip, dvc_name
| stats values(*) AS * BY dest_ip
| rename src_zone AS From, src_ip AS Source, dest_zone AS To, dest_ip AS Destination, server_name AS SNI, transport AS Protocol, dest_port AS Port, app AS "Application", rule AS "Rule", action AS "Action", session_end_reason AS "End Reason", packets_out AS "Packets Out", packets_in AS "Packets In", src_translated_ip AS "Egress IP", dvc_name AS "DC"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 07:50:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rename-fields-when-using-2-queries-with-OR/m-p/708320#M239545</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2025-01-09T07:50:02Z</dc:date>
    </item>
  </channel>
</rss>

