<?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: evaluate values from two different lookups in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338346#M159718</link>
    <description>&lt;P&gt;Your query is quite confusing right now. Could you provide the main search from where data will be generated? is month_data.csv your second lookup OR it's indexed data? Meanwhile give this a try (assuming month_data.csv is second lookup)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="JUNK" sourcetype=applications 
| lookup assignment_schedule assignment_group OUTPUT available_mins_weekdays
| eval month=strftime(_time,"%b")
| lookup month_data.csv month OUTPUT weekdays
| eval wk_min=(available_mins_weekdays/5)*weekdays
| table assignment_group month wk_min ...other fields...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 15:09:59 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2020-09-29T15:09:59Z</dc:date>
    <item>
      <title>evaluate values from two different lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338345#M159717</link>
      <description>&lt;P&gt;I have a lookup file assignment_schedule containing below sample data &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;assignment_group   task_order   schedule                  available_mins_weekdays     available_mins_weekends
rxpress            Ecommerce    Avail:24x7 Maint:N/A      7200                        2880
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to evaluate the number of available mins in a month and for that have another lookup , calculation will be (available_mins_weekdays/5)*weekdays &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;month     saturday     sunday     weekdays     days
Jan       4            5          22           31
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I expect data to be in form &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;assignment_group     month     available mins
abc                  Jan       22*(7200/5)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying below query but it is not giving me results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup assignment_schedule
| join type=outer assignment_group  [search index="JUNK" sourcetype=applications [search index=test source=month_data.csv| eval wk_min=(available_mins_weekdays/5)*weekdays ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:06:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338345#M159717</guid>
      <dc:creator>bic</dc:creator>
      <dc:date>2020-09-29T15:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate values from two different lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338346#M159718</link>
      <description>&lt;P&gt;Your query is quite confusing right now. Could you provide the main search from where data will be generated? is month_data.csv your second lookup OR it's indexed data? Meanwhile give this a try (assuming month_data.csv is second lookup)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="JUNK" sourcetype=applications 
| lookup assignment_schedule assignment_group OUTPUT available_mins_weekdays
| eval month=strftime(_time,"%b")
| lookup month_data.csv month OUTPUT weekdays
| eval wk_min=(available_mins_weekdays/5)*weekdays
| table assignment_group month wk_min ...other fields...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:09:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338346#M159718</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T15:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate values from two different lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338347#M159719</link>
      <description>&lt;P&gt;@bic - I cleaned up the formatting and marked the code for you.  I also added a closing square brace on your query, since it could not possibly run without it, but I suspect that the code isn't exactly right.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:04:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338347#M159719</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-31T15:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate values from two different lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338348#M159720</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="JUNK" sourcetype=applications
[search index=test source=month_data.csv | eval wk_min=(available_mins_weekdays/5)*weekdays ]
| append [|inputlookup assignment_schedule | eval sourcetype="fromInputlookup" ]
| stats values(*) AS * dc(sourcetype) AS numSourcetypes BY assignment_group
| where numSourcetypes=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This keeps only those events which are in either source but not both (outer join).&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:12:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338348#M159720</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-31T15:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: evaluate values from two different lookups</title>
      <link>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338349#M159721</link>
      <description>&lt;P&gt;In general, here's how to do a cross join in splunk...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your first search or file ...
| eval CrossJoinMe = 1 
| join max=0 CrossJoinMe [your second search or file | eval CrossJoinMe = 1 ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And here's your search...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup assignment_schedule
| eval CrossJoinMe = 1 
| rename COMMENT as "the above gets all the assignment groups"
| rename COMMENT as "In this case, 1 means Yes I Really Want All Records Cross Joined "

| rename COMMENT as "join every record above with every record in the other table"
| rename COMMENT as " max=0 also has to be set to mean Yes I Really Want All Records Cross Joined "
| join max=0 CrossJoinMe [search index=test source=month_data.csv | streamstats count as recno | eval CrossJoinMe = 1 ] 

| rename COMMENT as "calculate minutes, order records and cut to desired fields"
| eval available_mins = round(weekdays*(available_mins_weekdays/5))
| sort 0 assignment_group recno
| table assignment group month available_mins
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;One additional note - I assumed, since you have a 3-character month, that the month records are in date order but without any year or actual date information.  That order is what the &lt;CODE&gt;| streamstats count as recno&lt;/CODE&gt; and &lt;CODE&gt;| sort 0 assignment_group recno&lt;/CODE&gt; are trying to preserve.  If, on the other hand, the month date is a real date, then get rid of the streamstats and change the sort to sort by the assignment group and date.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/evaluate-values-from-two-different-lookups/m-p/338349#M159721</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-31T15:41:47Z</dc:date>
    </item>
  </channel>
</rss>

