<?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 coalesce three events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689939#M235047</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/268726"&gt;@shimada-k&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Yes correct.&lt;/P&gt;&lt;P&gt;you don't have the interface field in all the events so you cannot display it in all raws.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 08:50:06 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2024-06-07T08:50:06Z</dc:date>
    <item>
      <title>How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689893#M235032</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I would like to create the following table from the three events.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ipv4-entry_prefix           network-instance_name          interface
----------------------------------------------------------------------
1.1.1.0/24                  VRF_1001                       Ethernet48&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both event#1 and event#2 have "tags.next-hop-group" field and both event#2 and event#3 have "tags.index" field.All events are stored in the same index. I tried to write a proper SPL to achieve the above, but I couldn't. Could you please tell me how to achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;- event#1
{
  "name": "fib",
  "timestamp": 1717571778600,
  "tags": {
    "ipv4-entry_prefix": "1.1.1.0/24",
    "network-instance_name": "VRF_1001",
    "next-hop-group": "1297036705567609741",
    "source": "r0",
    "subscription-name": "fib"
  }
}
- event#2
{
  "name": "fib",
  "timestamp": 1717572745136,
  "tags": {
    "index": "140400192798928",
    "network-instance_name": "VRF_1001",
    "next-hop-group": "1297036705567609741",
    "source": "r0",
    "subscription-name": "fib"
  },
  "values": {
    "index": "140400192798928"
  }
}
-event#3
{
  "name": "fib",
  "timestamp": 1717572818890,
  "tags": {
    "index": "140400192798928",
    "network-instance_name": "VRF_1001",
    "source": "r0",
    "subscription-name": "fib"
  },
  "values": {
    "interface": "Ethernet48"
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Kenji&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 04:09:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689893#M235032</guid>
      <dc:creator>shimada-k</dc:creator>
      <dc:date>2024-06-07T04:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689895#M235033</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/268726"&gt;@shimada-k&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index ("tags.next-hop-group"=* OR "tags.index"=*)
| rename 
     "tags.next-hop-group" AS tags_next_hop_group
     "tags.index" AS tags_index
     "ipv4-entry_prefix" AS ipv4_entry_prefix
     "network-instance_name" AS network_instance_name
| eva tags_index=coalesce(tags_index, tags_next_hop_group)
| stats 
     vaues(ipv4_entry_prefix) AS ipv4_entry_prefix
     values(network_instance_name) AS network_instance_name
     values(interface) AS interface
     BY tags_next_hop_group&lt;/LI-CODE&gt;&lt;P&gt;in other words, you have to coalesce events with the fields&amp;nbsp;&lt;SPAN&gt;"tags.next-hop-group" and "tags.index" and use it as key in a stats command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I had to rename your fields because sometimes eval and stats commands doesn't correctly work when inside the field there are spaces, dots or minus char.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 04:26:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689895#M235033</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-07T04:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689898#M235034</link>
      <description>&lt;P&gt;What about&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(tags.ipv4-entry_prefix) as ipv4-entry_prefix values(tags.network-instance_name) as network-instance_name values(values.interface) as interface&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields *.ipv4-entry_prefix *.network-instance_name *.interface
| stats values(*) as *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The latter will give&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;tags.ipv4-entry_prefix&lt;/TD&gt;&lt;TD&gt;tags.network-instance_name&lt;/TD&gt;&lt;TD&gt;values.interface&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1.1.1.0/24&lt;/TD&gt;&lt;TD&gt;VRF_1001&lt;/TD&gt;&lt;TD&gt;Ethernet48&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 04:41:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689898#M235034</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-06-07T04:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689914#M235040</link>
      <description>&lt;P&gt;Hi gcusello,&lt;/P&gt;&lt;P&gt;Thanks for your prompt reply. I tried your solution. It's almost perfect, but interface field does not appear. I would appreciate it if you could give me an additional advice to resolve it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=gnmi ("tags.next-hop-group"=* OR "tags.index"=*)
| rename 
     "tags.next-hop-group" AS tags_next_hop_group
     "tags.index" AS tags_index
     "tags.ipv4-entry_prefix" AS ipv4_entry_prefix
     "tags.network-instance_name" AS network_instance_name
| eval tags_index=coalesce(tags_index, tags_next_hop_group)
| stats 
     values(ipv4_entry_prefix) AS ipv4_entry_prefix
     values(network_instance_name) AS network_instance_name
     values(tags.interface) AS interface
     BY tags_index
| sort ipv4_entry_prefix network_instance_name&lt;/LI-CODE&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shimadak_1-1717742898702.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31206iF502B6D2B065DD72/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shimadak_1-1717742898702.png" alt="shimadak_1-1717742898702.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Kenji&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 06:49:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689914#M235040</guid>
      <dc:creator>shimada-k</dc:creator>
      <dc:date>2024-06-07T06:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689918#M235044</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/268726"&gt;@shimada-k&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;sorry I mistyped the field name, probably the interface field name is different, probably its only "interface",&lt;/P&gt;&lt;P&gt;please see the exact field name and replace it in the search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=gnmi ("tags.next-hop-group"=* OR "tags.index"=*)
| rename 
     "tags.next-hop-group" AS tags_next_hop_group
     "tags.index" AS tags_index
     "tags.ipv4-entry_prefix" AS ipv4_entry_prefix
     "tags.network-instance_name" AS network_instance_name
| eval tags_index=coalesce(tags_index, tags_next_hop_group)
| stats 
     values(ipv4_entry_prefix) AS ipv4_entry_prefix
     values(network_instance_name) AS network_instance_name
     values(interface) AS interface
     BY tags_index
| sort ipv4_entry_prefix network_instance_name&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 07:14:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689918#M235044</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-07T07:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689935#M235045</link>
      <description>&lt;P&gt;Thanks again, gcusello. Much appreciated.&lt;/P&gt;&lt;P&gt;Do I need to add &amp;lt;"values.interface" AS interface&amp;gt; in rename, correct?&lt;/P&gt;&lt;P&gt;I executed the following query.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=gnmi ("tags.next-hop-group"=* OR "tags.index"=*) earliest="06/07/2024:08:28:14"
| rename 
     "tags.next-hop-group" AS tags_next_hop_group
     "tags.index" AS tags_index
     "tags.ipv4-entry_prefix" AS ipv4_entry_prefix
     "tags.network-instance_name" AS network_instance_name
     "values.interface" AS interface
| eval tags_index=coalesce(tags_index, tags_next_hop_group)
| stats 
     values(ipv4_entry_prefix) AS ipv4_entry_prefix
     values(network_instance_name) AS network_instance_name
     values(interface) AS interface
     BY tags_index
| sort ipv4_entry_prefix network_instance_name&lt;/LI-CODE&gt;&lt;P&gt;Then I received the following result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shimadak_0-1717749393104.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31212i3A21318D455F160E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shimadak_0-1717749393104.png" alt="shimadak_0-1717749393104.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My expectation is that "Ethernet48" appears in 1st and 2nd line.&lt;/P&gt;&lt;P&gt;The data is as follows.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shimadak_1-1717749521252.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31213iDB4503FDE5D6940B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shimadak_1-1717749521252.png" alt="shimadak_1-1717749521252.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shimadak_2-1717749557635.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31214i2CBA532DF7378D3C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shimadak_2-1717749557635.png" alt="shimadak_2-1717749557635.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="shimadak_3-1717749615189.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31215i326E4693E3653EF6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="shimadak_3-1717749615189.png" alt="shimadak_3-1717749615189.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Kenji&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;</description>
      <pubDate>Fri, 07 Jun 2024 08:41:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689935#M235045</guid>
      <dc:creator>shimada-k</dc:creator>
      <dc:date>2024-06-07T08:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689939#M235047</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/268726"&gt;@shimada-k&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Yes correct.&lt;/P&gt;&lt;P&gt;you don't have the interface field in all the events so you cannot display it in all raws.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 08:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/689939#M235047</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-07T08:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/690065#M235069</link>
      <description>&lt;P&gt;OK. Thanks for you help,&amp;nbsp;gcusello.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2024 04:36:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/690065#M235069</guid>
      <dc:creator>shimada-k</dc:creator>
      <dc:date>2024-06-08T04:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to coalesce three events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/690119#M235077</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/268726"&gt;@shimada-k&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;let us know if we can help you more, or, please, accept one answer for the other people of Community.&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>Sun, 09 Jun 2024 09:51:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-coalesce-three-events/m-p/690119#M235077</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-06-09T09:51:48Z</dc:date>
    </item>
  </channel>
</rss>

