<?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 use join on fields with wildcards (hyphen &amp;quot;-&amp;quot;, ampersand &amp;quot; &amp;&amp;quot; doesn't work) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464929#M130997</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/60662"&gt;@jpolvino&lt;/a&gt; , we are using join of two  queries on  the  field  taskcurrentstatus, that combined from number, state and group name.&lt;BR /&gt;
For example:&lt;BR /&gt;
      taskcurrentstatus: "TASK0001OpenService - Tools" &lt;BR /&gt;
OR &lt;BR /&gt;
      taskcurrentstatus: "TASK0001OpenService &amp;amp; Tools" &lt;/P&gt;

&lt;P&gt;index=snow_index sourcetype=task_lookup_dat_csv&lt;BR /&gt;
| eval taskcurrentstatus=number+state+group&lt;BR /&gt;
| eval ExistingInSummaryTable="No"&lt;BR /&gt;
| fields number,state,taskcurrentstatus,group,ExistingInSummaryTable&lt;/P&gt;

&lt;P&gt;| join type=left taskcurrentstatus&lt;BR /&gt;
   [&lt;BR /&gt;
   search  index=snow_index_2 &lt;BR /&gt;
   | eval  taskcurrentstatus=t_number+t_state+t_group&lt;BR /&gt;
   | eval ExistingInSummaryTable="Yes"&lt;BR /&gt;
   | fields t_number,t_state,t_group,taskcurrentstatus,ExistingInSummaryTable&lt;BR /&gt;
   ]&lt;BR /&gt;
|table  _time t_number  t_state  t_group number state group taskcurrentstatus  ExistingInSummaryTable&lt;BR /&gt;
| search ExistingInSummaryTable="No"&lt;/P&gt;

&lt;P&gt;So, when "-" or "&amp;amp;" is part of group name,  taskcurrentstatus  is not found &lt;BR /&gt;
in the inner join .&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:21:50 GMT</pubDate>
    <dc:creator>mlevsh</dc:creator>
    <dc:date>2020-09-30T03:21:50Z</dc:date>
    <item>
      <title>How to use join on fields with wildcards (hyphen "-", ampersand " &amp;" doesn't work)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464927#M130995</link>
      <description>&lt;P&gt;For one of our project , we are running the join on fields that contain hyphen or ampersand and it doesn't work.&lt;BR /&gt;
Let's say we join two sets of queries on field that set to "Service - Tools" or field="Service &amp;amp; Tools" with "-" or "&amp;amp;" - that field is not found in sub-search even though it is there.&lt;/P&gt;

&lt;P&gt;We suspect it is because of hyphen  "-" and  ampersand "&amp;amp;" being inside of the value.&lt;BR /&gt;
Will appreciate any advice.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 17:05:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464927#M130995</guid>
      <dc:creator>mlevsh</dc:creator>
      <dc:date>2019-12-11T17:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join on fields with wildcards (hyphen "-", ampersand " &amp;" doesn't work)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464928#M130996</link>
      <description>&lt;P&gt;What does your search look like? This is a simple test that shows the values you posted do match:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval field1a="Service - Tools" | eval field1b="Service - Tools"
| eval field2a="Service &amp;amp; Tools" | eval field2b="Service &amp;amp; Tools"
| eval match1=if(field1a==field1b,"Match","Mismatch")
| eval match2=if(field2a==field2b,"Match","Mismatch")
| table field1a field1b match1 field2a field2b match2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Dec 2019 17:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464928#M130996</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-12-11T17:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join on fields with wildcards (hyphen "-", ampersand " &amp;" doesn't work)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464929#M130997</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/60662"&gt;@jpolvino&lt;/a&gt; , we are using join of two  queries on  the  field  taskcurrentstatus, that combined from number, state and group name.&lt;BR /&gt;
For example:&lt;BR /&gt;
      taskcurrentstatus: "TASK0001OpenService - Tools" &lt;BR /&gt;
OR &lt;BR /&gt;
      taskcurrentstatus: "TASK0001OpenService &amp;amp; Tools" &lt;/P&gt;

&lt;P&gt;index=snow_index sourcetype=task_lookup_dat_csv&lt;BR /&gt;
| eval taskcurrentstatus=number+state+group&lt;BR /&gt;
| eval ExistingInSummaryTable="No"&lt;BR /&gt;
| fields number,state,taskcurrentstatus,group,ExistingInSummaryTable&lt;/P&gt;

&lt;P&gt;| join type=left taskcurrentstatus&lt;BR /&gt;
   [&lt;BR /&gt;
   search  index=snow_index_2 &lt;BR /&gt;
   | eval  taskcurrentstatus=t_number+t_state+t_group&lt;BR /&gt;
   | eval ExistingInSummaryTable="Yes"&lt;BR /&gt;
   | fields t_number,t_state,t_group,taskcurrentstatus,ExistingInSummaryTable&lt;BR /&gt;
   ]&lt;BR /&gt;
|table  _time t_number  t_state  t_group number state group taskcurrentstatus  ExistingInSummaryTable&lt;BR /&gt;
| search ExistingInSummaryTable="No"&lt;/P&gt;

&lt;P&gt;So, when "-" or "&amp;amp;" is part of group name,  taskcurrentstatus  is not found &lt;BR /&gt;
in the inner join .&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:21:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464929#M130997</guid>
      <dc:creator>mlevsh</dc:creator>
      <dc:date>2020-09-30T03:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join on fields with wildcards (hyphen "-", ampersand " &amp;" doesn't work)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464930#M130998</link>
      <description>&lt;P&gt;so....&lt;/P&gt;

&lt;P&gt;snow_index has taskcurrentstatus: "TASK0001OpenService - Tools"&lt;BR /&gt;
snow_index_2 has taskcurrentstatus: "TASK0001OpenService &amp;amp; Tools"&lt;/P&gt;

&lt;P&gt;You can't just join on taskcurrentstatus and expect it to match those two together, because they don't match.&lt;/P&gt;

&lt;P&gt;you'd need to do something like:&lt;BR /&gt;
&lt;CODE&gt;|replace "* - *" with "* &amp;amp; *" in group&lt;/CODE&gt; before you eval taskcurrentstatus and a similar one in the subsearch with t_group&lt;/P&gt;

&lt;P&gt;but really, you shouldn't use join, it's ugly and has limitations.&lt;BR /&gt;
try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=snow_index sourcetype=task_lookup_dat_csv) OR (index=snow_index_2)
| eval ExistingInSummaryTable=if(index=snow_index,"No","Yes")
| eval taskcurrentstatus=coalesce(number+state+group,t_number+t_state+t_group)
| stats values(t_number) as t_number values(t_state) as t_state values(t_group) as t_group values(ExistingInSummaryTable) as ExistingInSummaryTable by taskcurrentstatus| search ExistingInSummaryTable="No"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you might need to adjust that a bit, break it apart command by command, but you can do that search without a join, guarantee it.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:21:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/464930#M130998</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2020-09-30T03:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use join on fields with wildcards (hyphen "-", ampersand " &amp;&amp;quot; doesn't work)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/506688#M141745</link>
      <description>&lt;P&gt;Would this also work when trying to join values that have an ampersand? I am trying to join two tables based on four different categories but out of the three, the fourth category (XXXXX&amp;amp;) won't join its match.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 13:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-join-on-fields-with-wildcards-hyphen-quot-quot/m-p/506688#M141745</guid>
      <dc:creator>pc-ran</dc:creator>
      <dc:date>2020-06-30T13:41:27Z</dc:date>
    </item>
  </channel>
</rss>

