<?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: Pass a selected value to a join after calculations and other join with the same eventtype in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328431#M162610</link>
    <description>&lt;P&gt;I tried the proposal and I still get the result:&lt;/P&gt;

&lt;P&gt;host_number....days....total_records&lt;BR /&gt;
      174.... 2....376&lt;/P&gt;

&lt;P&gt;The data that I have as an example are:&lt;/P&gt;

&lt;P&gt;Eventttype=”State”&lt;/P&gt;

&lt;P&gt;loc=”location_1” host_number=5&lt;BR /&gt;&lt;BR /&gt;
host_1=56&lt;BR /&gt;
host_2=78&lt;BR /&gt;
host_3=89&lt;BR /&gt;
host_4=91&lt;BR /&gt;
host_5=62      total_records=376&lt;/P&gt;

&lt;P&gt;loc=”location_2” host_number=3&lt;BR /&gt;&lt;BR /&gt;
host_7=71&lt;BR /&gt;
host_8=70&lt;BR /&gt;
host_9=52     total_records=193&lt;/P&gt;

&lt;P&gt;loc=”location_3” host_number=8&lt;BR /&gt;&lt;BR /&gt;
host_10=85&lt;BR /&gt;
host_11=36&lt;BR /&gt;
host_12=97&lt;BR /&gt;
host_13=55&lt;BR /&gt;
host_14=48&lt;BR /&gt;
host_15=67&lt;BR /&gt;
host_16=76&lt;BR /&gt;
host_17=82&lt;BR /&gt;
host_18=68     total_records=614&lt;/P&gt;

&lt;P&gt;loc=”location_4” host_number=1&lt;BR /&gt;&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
. .. total_records=62&lt;BR /&gt;
loc=”location_5” host_number=2&lt;BR /&gt;&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
… total_records=118&lt;BR /&gt;
loc=”location_6” host_number=4 &lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
… total_records=235&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
etc&lt;/P&gt;

&lt;P&gt;I can not make the sum of the host_number that is 5 and not the total of the hosts that are operating&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:18:36 GMT</pubDate>
    <dc:creator>ricardocastille</dc:creator>
    <dc:date>2020-09-29T18:18:36Z</dc:date>
    <item>
      <title>Pass a selected value to a join after calculations and other join with the same eventtype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328429#M162608</link>
      <description>&lt;P&gt;This is the question; In general, I have been able to resolve my doubts after the publications here, but I have had problems with this a bit since I am struggling to pass a value to a join. &lt;/P&gt;

&lt;P&gt;What I am trying to do is the following: I have an eventtype called "State" that has locations, each of the locations have different host amounts assigned, and each host makes different amounts of records.&lt;/P&gt;

&lt;P&gt;I want to obtain the total number of the host assigned to the locality, the days of the selected period of time and the sum of the records of the host of the locality to be searched. I have modified this query in different ways and I do not achieve the result I want.&lt;/P&gt;

&lt;P&gt;eventtype="State"&lt;BR /&gt;&lt;BR /&gt;
| search loc="location_1" &lt;BR /&gt;
| dedup id  | stats count | rename count as total_records&lt;BR /&gt;&lt;BR /&gt;
| join loc type=left[| search eventtype="State" loc  | eval day_of_week = strftime(_time,"%A") | where NOT (day_of_week="Saturday" OR day_of_week="Sunday") &lt;BR /&gt;
| bin span=1d _time  | stats count dc(_time) as days by day_of_week | stats sum(days) as days ]&lt;BR /&gt;&lt;BR /&gt;
| join loc type=left[| search eventtype="State"  loc | dedup h | &lt;STRONG&gt;search loc&lt;/STRONG&gt;  | stats count(h) as host_number ]&lt;BR /&gt;
 | table host_number days total_records&lt;/P&gt;

&lt;P&gt;The result I get is the following:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;host_number....   days....    total_records&lt;/STRONG&gt;&lt;BR /&gt;
      174....          2....        376&lt;/P&gt;

&lt;P&gt;When modifying  | &lt;STRONG&gt;search loc by  | search loc = "$loc$"&lt;/STRONG&gt;, I get the following result:&lt;/P&gt;

&lt;P&gt;host_number.... days....    total_records&lt;BR /&gt;
        0....          2....          376&lt;/P&gt;

&lt;P&gt;The result of the host_number &lt;STRONG&gt;must be 5 and not 0&lt;/STRONG&gt;, I have modified the query in different ways and I can not join the value of loc (which I have been able to do in other queries). What option do I have to solve the query?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:17:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328429#M162608</guid>
      <dc:creator>ricardocastille</dc:creator>
      <dc:date>2020-09-29T18:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a selected value to a join after calculations and other join with the same eventtype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328430#M162609</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;can you try passing parameter before join query like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype="State" 
| search loc="location_1" 
| dedup id | stats count | rename count as total_records 
| join loc type=left[| search eventtype="State" loc | eval day_of_week = strftime(_time,"%A") | where NOT (day_of_week="Saturday" OR day_of_week="Sunday") 
| bin span=1d _time | stats count dc(_time) as days by day_of_week | stats sum(days) as days ] 
| join $loc$ type=left[| search eventtype="State" loc | dedup h | search loc | stats count(h) as host_number ]
| table host_number days total_records
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Mar 2018 04:09:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328430#M162609</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-03-05T04:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a selected value to a join after calculations and other join with the same eventtype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328431#M162610</link>
      <description>&lt;P&gt;I tried the proposal and I still get the result:&lt;/P&gt;

&lt;P&gt;host_number....days....total_records&lt;BR /&gt;
      174.... 2....376&lt;/P&gt;

&lt;P&gt;The data that I have as an example are:&lt;/P&gt;

&lt;P&gt;Eventttype=”State”&lt;/P&gt;

&lt;P&gt;loc=”location_1” host_number=5&lt;BR /&gt;&lt;BR /&gt;
host_1=56&lt;BR /&gt;
host_2=78&lt;BR /&gt;
host_3=89&lt;BR /&gt;
host_4=91&lt;BR /&gt;
host_5=62      total_records=376&lt;/P&gt;

&lt;P&gt;loc=”location_2” host_number=3&lt;BR /&gt;&lt;BR /&gt;
host_7=71&lt;BR /&gt;
host_8=70&lt;BR /&gt;
host_9=52     total_records=193&lt;/P&gt;

&lt;P&gt;loc=”location_3” host_number=8&lt;BR /&gt;&lt;BR /&gt;
host_10=85&lt;BR /&gt;
host_11=36&lt;BR /&gt;
host_12=97&lt;BR /&gt;
host_13=55&lt;BR /&gt;
host_14=48&lt;BR /&gt;
host_15=67&lt;BR /&gt;
host_16=76&lt;BR /&gt;
host_17=82&lt;BR /&gt;
host_18=68     total_records=614&lt;/P&gt;

&lt;P&gt;loc=”location_4” host_number=1&lt;BR /&gt;&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
. .. total_records=62&lt;BR /&gt;
loc=”location_5” host_number=2&lt;BR /&gt;&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
… total_records=118&lt;BR /&gt;
loc=”location_6” host_number=4 &lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
… total_records=235&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
etc&lt;/P&gt;

&lt;P&gt;I can not make the sum of the host_number that is 5 and not the total of the hosts that are operating&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:18:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328431#M162610</guid>
      <dc:creator>ricardocastille</dc:creator>
      <dc:date>2020-09-29T18:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a selected value to a join after calculations and other join with the same eventtype</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328432#M162611</link>
      <description>&lt;P&gt;I solved the problem after analyzing how the groups work, and it is as follows:&lt;/P&gt;

&lt;P&gt;eventtype="State"&lt;BR /&gt;&lt;BR /&gt;
| search loc="location_1"&lt;BR /&gt;
| dedup id &lt;BR /&gt;
| stats count &lt;BR /&gt;
| rename count as total_records , values(hostname), &lt;BR /&gt;
| rename values(hostname) as host&lt;BR /&gt;
| join loc type=left[| search eventtype="State" loc &lt;BR /&gt;
| eval day_of_week = strftime(_time,"%A")&lt;BR /&gt;
| where NOT (day_of_week="Saturday" OR day_of_week="Sunday") &lt;BR /&gt;
| bin span=1d _time &lt;BR /&gt;
| stats count dc(_time) as days by day_of_week &lt;BR /&gt;
| stats sum(days) as days ]&lt;BR /&gt;&lt;BR /&gt;
| eventstats count(host) as host_number &lt;BR /&gt;
| table host_number days total_records&lt;/P&gt;

&lt;P&gt;Thanks for the idea, it served as my base&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:21:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Pass-a-selected-value-to-a-join-after-calculations-and-other/m-p/328432#M162611</guid>
      <dc:creator>ricardocastille</dc:creator>
      <dc:date>2020-09-29T18:21:56Z</dc:date>
    </item>
  </channel>
</rss>

