<?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: Time from subquery lost when joining to lookup table in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71036#M1621</link>
    <description>&lt;P&gt;Assuming a client_lookup.csv like:&lt;/P&gt;

&lt;PRE&gt;
client_id,Name
20006,Client A
&lt;/PRE&gt;

&lt;P&gt;You could do something like:&lt;/P&gt;

&lt;PRE&gt;
type="REST" resource="Order" status="FINISHED" | bucket span=1d _time 
| stats count by client_id, _time
| lookup client_lookup.csv client_id OUTPUT Name
&lt;/PRE&gt;

&lt;P&gt;No join needed.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jun 2012 20:26:35 GMT</pubDate>
    <dc:creator>sowings</dc:creator>
    <dc:date>2012-06-08T20:26:35Z</dc:date>
    <item>
      <title>Time from subquery lost when joining to lookup table</title>
      <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71035#M1620</link>
      <description>&lt;P&gt;I have a report which I'm trying to enhance to use a lookup report. The existing query is doing a simple agg to count by date and identifier:&lt;/P&gt;

&lt;P&gt;type="REST" resource="Order" status="FINISHED" | bucket span=1d _time | stats count by client_id, _time&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
&lt;STRONG&gt;_time                   client_id      count&lt;/STRONG&gt;&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20006          123&lt;BR /&gt;
6/8/12 12:00:00.000 AM  20006          117&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20008          36&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20009          101&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I'm using a lookup table to enhance the data but I also want to see records from the lookup table which had no events. Something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
&lt;STRONG&gt;_time                   client_id      Name           count&lt;/STRONG&gt;&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20006         Client A       123&lt;BR /&gt;
6/8/12 12:00:00.000 AM  20006         Client A       117&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20008         Client B       36&lt;BR /&gt;
6/8/12 12:00:00.000 AM  20008         Client B       0&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20009         Client C       101&lt;BR /&gt;
6/8/12 12:00:00.000 AM  20009         Client C       0&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20010         Client D       0&lt;BR /&gt;
6/8/12 12:00:00.000 AM  20010         Client D       0&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I thought I'd be able to accomplish this by using inputlookup and left joining to the results from the original query&lt;/P&gt;

&lt;P&gt;| inputlookup client_lookup.csv | JOIN type=left client_id  [type="REST" resource="Order" status="FINISHED" | bucket span=1d _time | stats count by client_id, _time]&lt;/P&gt;

&lt;P&gt;When I do this, the date from the subquery is lost from the output:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
&lt;STRONG&gt;client_id      Name           count&lt;/STRONG&gt;&lt;BR /&gt;
20006         Client A       123&lt;BR /&gt;
20008         Client B       36&lt;BR /&gt;
20009         Client C       101&lt;BR /&gt;
20010         Client D&lt;BR /&gt;&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I obviously have my head stuck in RDBMS land! I'm sure there's probably a better way of doing this or I'm missing something obvious but I'm a little stuck at the moment. Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2012 19:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71035#M1620</guid>
      <dc:creator>mcantrell</dc:creator>
      <dc:date>2012-06-08T19:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Time from subquery lost when joining to lookup table</title>
      <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71036#M1621</link>
      <description>&lt;P&gt;Assuming a client_lookup.csv like:&lt;/P&gt;

&lt;PRE&gt;
client_id,Name
20006,Client A
&lt;/PRE&gt;

&lt;P&gt;You could do something like:&lt;/P&gt;

&lt;PRE&gt;
type="REST" resource="Order" status="FINISHED" | bucket span=1d _time 
| stats count by client_id, _time
| lookup client_lookup.csv client_id OUTPUT Name
&lt;/PRE&gt;

&lt;P&gt;No join needed.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2012 20:26:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71036#M1621</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-06-08T20:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Time from subquery lost when joining to lookup table</title>
      <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71037#M1622</link>
      <description>&lt;P&gt;The reason for the join is so that I also display the clients which don't have any matching events. Without the left join, they drop off the report.&lt;/P&gt;

&lt;P&gt;Ultimately, I want to draw attention to clients which have low or no activity. I realize this is sort of the reverse of what splunk is meant to do but I've never been shy of driving a square peg through a round hole &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2012 20:42:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71037#M1622</guid>
      <dc:creator>mcantrell</dc:creator>
      <dc:date>2012-06-08T20:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Time from subquery lost when joining to lookup table</title>
      <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71038#M1623</link>
      <description>&lt;P&gt;Join is really not preferred, but if you want to mess with your original query, then rename the &lt;CODE&gt;_time&lt;/CODE&gt; field to something not beginning with an &lt;CODE&gt;_&lt;/CODE&gt;, then name it back after the join.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2012 21:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71038#M1623</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2012-06-08T21:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Time from subquery lost when joining to lookup table</title>
      <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71039#M1624</link>
      <description>&lt;P&gt;Hmmmm, renaming the field helps a little. The date is available now but something is weird in how it's joining the records. It's finding the first match for each client and then dumping the other dates.&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;*&lt;EM&gt;sent                    client_id   Name      count *&lt;/EM&gt;&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20006       Client A  123 &lt;BR /&gt;
6/7/12 12:00:00.000 AM  20008       Client B  36 &lt;BR /&gt;
6/7/12 12:00:00.000 AM  20009       Client C  101 &lt;BR /&gt;
6/7/12 12:00:00.000 AM  20010       Client D&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jun 2012 12:16:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71039#M1624</guid>
      <dc:creator>mcantrell</dc:creator>
      <dc:date>2012-06-09T12:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Time from subquery lost when joining to lookup table</title>
      <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71040#M1625</link>
      <description>&lt;P&gt;Instead of:&lt;/P&gt;

&lt;P&gt;*&lt;EM&gt;sent                    client_id   Name      count *&lt;/EM&gt;&lt;BR /&gt;
6/7/12 12:00:00.000 AM  20006       Client A  123 &lt;BR /&gt;
6/8/12 12:00:00.000 AM  20006       Client A  117 &lt;BR /&gt;
6/7/12 12:00:00.000 AM  20008       Client B  36 &lt;BR /&gt;
6/8/12 12:00:00.000 AM  20008       Client B  0 &lt;BR /&gt;
6/7/12 12:00:00.000 AM  20009       Client C  101 &lt;BR /&gt;
6/8/12 12:00:00.000 AM  20009       Client C  0 &lt;BR /&gt;
6/7/12 12:00:00.000 AM  20010       Client D&lt;BR /&gt;&lt;BR /&gt;
6/8/12 12:00:00.000 AM  20010       Client D  &lt;/P&gt;

&lt;P&gt;It appears that it probably doesn't work exactly like it would in SQL. Maybe there's a better approach to accomplish the same end.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jun 2012 12:17:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71040#M1625</guid>
      <dc:creator>mcantrell</dc:creator>
      <dc:date>2012-06-09T12:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Time from subquery lost when joining to lookup table</title>
      <link>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71041#M1626</link>
      <description>&lt;P&gt;OK.. I think I have it now. There is a max option to the join command which defaults to 1. I adjusted it to match the number of days I was searching for and the all of the records are showing up.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2012 15:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Time-from-subquery-lost-when-joining-to-lookup-table/m-p/71041#M1626</guid>
      <dc:creator>mcantrell</dc:creator>
      <dc:date>2012-06-11T15:10:32Z</dc:date>
    </item>
  </channel>
</rss>

