<?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: combine different fileds from different events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306038#M164739</link>
    <description>&lt;P&gt;Hello again,&lt;/P&gt;

&lt;P&gt;Option 1 is better, it was my fault, I missed type a field..oups &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thank you again DalJeanis &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Have a great day&lt;/P&gt;</description>
    <pubDate>Wed, 29 Nov 2017 14:00:17 GMT</pubDate>
    <dc:creator>mvagionakis</dc:creator>
    <dc:date>2017-11-29T14:00:17Z</dc:date>
    <item>
      <title>combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306030#M164731</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to combine values from two events and to make a table with them.&lt;BR /&gt;
Let me explain you.&lt;BR /&gt;
I have the same index, the same source and the same sourcetype but some fields are named differently.&lt;/P&gt;

&lt;P&gt;Below an example:&lt;/P&gt;

&lt;P&gt;event1:&lt;BR /&gt;
SNMPv2-SMI::enterprises."5560.300.9002.1.3.111.112.113.114.0" = "state" &lt;BR /&gt;
somestate = state&lt;BR /&gt;&lt;BR /&gt;
remote_gateway_st = 111.112.113.114&lt;BR /&gt;
host =  titi&lt;BR /&gt;&lt;BR /&gt;
index = someindex&lt;BR /&gt;&lt;BR /&gt;
linecount = 1&lt;BR /&gt;&lt;BR /&gt;
punct = -::."........."&lt;EM&gt;=&lt;/EM&gt;""_&lt;BR /&gt;&lt;BR /&gt;
source =    snmp://test &lt;BR /&gt;
sourcetype =    sourcetype_toto &lt;BR /&gt;
splunk_server = host1&lt;BR /&gt;&lt;BR /&gt;
splunk_server_group =   dmc_group_indexer&lt;BR /&gt;&lt;BR /&gt;
timestamp = none    &lt;/P&gt;

&lt;P&gt;event2:&lt;BR /&gt;
SNMPv2-SMI::enterprises."5560.300.9002.1.2.217.167.157.241.0" = "a_client" &lt;/P&gt;

&lt;P&gt;ClientName =    a_client&lt;BR /&gt;&lt;BR /&gt;
remote_gateway =    111.112.113.114 &lt;BR /&gt;
host =  titi&lt;BR /&gt;&lt;BR /&gt;
index = someindex&lt;BR /&gt;&lt;BR /&gt;
linecount = 1&lt;BR /&gt;&lt;BR /&gt;
punct = -::."........."&lt;EM&gt;=&lt;/EM&gt;""_&lt;BR /&gt;&lt;BR /&gt;
source =    snmp://test &lt;BR /&gt;
sourcetype =    sourcetype_toto &lt;BR /&gt;
splunk_server = host1&lt;BR /&gt;&lt;BR /&gt;
splunk_server_group =   dmc_group_indexer&lt;BR /&gt;&lt;BR /&gt;
timestamp = none    &lt;/P&gt;

&lt;P&gt;My goal is to combine them when &lt;STRONG&gt;remote_gateway_st=remote_gateway&lt;/STRONG&gt; and to put in a table the fields &lt;STRONG&gt;remote_gateway_st ,ClientName,somestate&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;I tried &lt;STRONG&gt;join&lt;/STRONG&gt; function but I couldn't make it work.&lt;/P&gt;

&lt;P&gt;Could you give me some help please? &lt;/P&gt;

&lt;P&gt;Thank you in advance,&lt;BR /&gt;
Michail&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:58:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306030#M164731</guid>
      <dc:creator>mvagionakis</dc:creator>
      <dc:date>2020-09-29T16:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306031#M164732</link>
      <description>&lt;P&gt;There are lots of ways.&lt;/P&gt;

&lt;P&gt;Method 1 - Splunk Stew (This method is generally preferred)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someindex host="titi" source="snmp://test" sourcetype="sourcetype_toto"
( ClientName="a_client" OR somestate="state") 
| fields index host source sourcetype remote_gateway* somestate ClientName 
| eval remote_gateway_merged=coalesce(remote_gateway,remote_gateway_st)
| stats values(*) as * by remote_gateway_merged 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Method 2 - Join &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someindex host="titi" source="snmp://test" sourcetype="sourcetype_toto"
 ClientName="a_client"
| fields index host source sourcetype remote_gateway somestate ClientName 
| join remote_gateway [search 
    index=someindex host="titi" source="snmp://test" sourcetype="sourcetype_toto"
    somestate="state"
    | fields remote_gateway_st somestate  
    | rename  remote_gateway_st as remote_gateway
    | table remote_gateway somestate
    ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Nov 2017 17:10:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306031#M164732</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-28T17:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306032#M164733</link>
      <description>&lt;P&gt;HI &lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=someindex 
| eval remote_gateway_st=coalesce(remote_gateway,remote_gateway_st) 
| stats values(ClientName) as ClientName values(somestate) as somestate by remote_gateway_st
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tried with your provided data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval _raw="SNMPv2-SMI::enterprises. \"5560.300.9002.1.3.111.112.113.114.0 \" =  \"state \"  \n 
somestate = state  \n 
remote_gateway_st = 111.112.113.114 \n 
host = titi  \n 
index = someindex  \n 
linecount = 1  \n 
punct = -::. \"......... \"= \" \"_  \n 
source = snmp://test  \n 
sourcetype = sourcetype_toto  \n 
splunk_server = host1  \n 
splunk_server_group = dmc_group_indexer  \n 
timestamp = none" | kv | append [| makeresults | eval _raw="SNMPv2-SMI::enterprises. \"5560.300.9002.1.2.217.167.157.241.0 \" =  \"a_client \" \n 
 \n 
ClientName = a_client  \n 
remote_gateway = 111.112.113.114  \n 
host = titi  \n 
index = someindex  \n 
linecount = 1  \n 
punct = -::. \"......... \"= \" \"_  \n 
source = snmp://test  \n 
sourcetype = sourcetype_toto  \n 
splunk_server = host1  \n 
splunk_server_group = dmc_group_indexer  \n 
timestamp = none" | kv] | eval remote_gateway_st=coalesce(remote_gateway,remote_gateway_st)  | stats values(ClientName) as ClientName values(somestate) as somestate by remote_gateway_st
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Happy Splunking&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 17:11:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306032#M164733</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-28T17:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306033#M164734</link>
      <description>&lt;P&gt;I would go for option 1. Joins are expensive, so unless you have multiple events per emote_gateway values, you can use option 1.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 19:19:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306033#M164734</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-28T19:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306034#M164735</link>
      <description>&lt;P&gt;@kamlesh_vaghela -  Good job.  One improvement..&lt;/P&gt;

&lt;P&gt;This... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval remote_gateway_st=if(isnotnull(remote_gateway),remote_gateway,remote_gateway_st) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...can be written as this ... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval remote_gateway_st=coalesce(remote_gateway,remote_gateway_st) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...which makes the code easier to read - especially if you have one more item to coalesce together.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 20:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306034#M164735</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-28T20:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306035#M164736</link>
      <description>&lt;P&gt;hi @DalKeanis, Yeah readability make sense. Thanks for improvement. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 04:53:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306035#M164736</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-29T04:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306036#M164737</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;only the second method worked but partially.&lt;BR /&gt;
By adding dedup command on "clientname" and by searching only the events that contains somestate AND clientname, I got the perfect result.&lt;/P&gt;

&lt;P&gt;Thank you very much for your help and reactivity &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Have a good day&lt;BR /&gt;
Michail&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 08:37:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306036#M164737</guid>
      <dc:creator>mvagionakis</dc:creator>
      <dc:date>2017-11-29T08:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306037#M164738</link>
      <description>&lt;P&gt;hello Kamlesh, thanks for replying to my question.&lt;BR /&gt;
update: it was my mistake as I said for DalJeanis reply...yours works also very well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
I thank you again for your time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Have a great day.&lt;BR /&gt;
Michail&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 08:40:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306037#M164738</guid>
      <dc:creator>mvagionakis</dc:creator>
      <dc:date>2017-11-29T08:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306038#M164739</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;

&lt;P&gt;Option 1 is better, it was my fault, I missed type a field..oups &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thank you again DalJeanis &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Have a great day&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 14:00:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306038#M164739</guid>
      <dc:creator>mvagionakis</dc:creator>
      <dc:date>2017-11-29T14:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: combine different fileds from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306039#M164740</link>
      <description>&lt;P&gt;Ah, good.  Glad to help.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 23:27:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-different-fileds-from-different-events/m-p/306039#M164740</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-11-29T23:27:42Z</dc:date>
    </item>
  </channel>
</rss>

