<?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: Why is my stats search on 2 indexes not returning fields from one index? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154165#M43325</link>
    <description>&lt;P&gt;I (and I believe everyone else here) understand what you want. The search we proposed is exactly what you need, but it seems there are other problems, the time difference for example. Those are not things we can help you with if you don't post your data (you can anonymize it).&lt;/P&gt;</description>
    <pubDate>Wed, 22 Apr 2015 13:32:46 GMT</pubDate>
    <dc:creator>jeffland</dc:creator>
    <dc:date>2015-04-22T13:32:46Z</dc:date>
    <item>
      <title>Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154143#M43303</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have 2 indexes:&lt;BR /&gt;
index="abc" with fields &lt;CODE&gt;uri&lt;/CODE&gt;, &lt;CODE&gt;a&lt;/CODE&gt;, &lt;CODE&gt;b&lt;/CODE&gt;, &lt;CODE&gt;c&lt;/CODE&gt; &lt;BR /&gt;
and &lt;BR /&gt;
index="xyz" with fields &lt;CODE&gt;url&lt;/CODE&gt;, &lt;CODE&gt;x&lt;/CODE&gt;, &lt;CODE&gt;y&lt;/CODE&gt;, &lt;CODE&gt;z&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Now the fields &lt;CODE&gt;url&lt;/CODE&gt; and &lt;CODE&gt;uri&lt;/CODE&gt; have the same values in both indexes, but this is just a change in the field name.&lt;/P&gt;

&lt;P&gt;I want to search both the indexes for all fields &lt;CODE&gt;a&lt;/CODE&gt;, &lt;CODE&gt;b&lt;/CODE&gt;, &lt;CODE&gt;c&lt;/CODE&gt;, &lt;CODE&gt;x&lt;/CODE&gt;, &lt;CODE&gt;y&lt;/CODE&gt;, &lt;CODE&gt;z&lt;/CODE&gt; by &lt;CODE&gt;url&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" or index="xyz" | eval url=uri | stats values(a),values(b), values(x), values(y) by url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Problem is it is only showing the fields &lt;CODE&gt;a&lt;/CODE&gt;, &lt;CODE&gt;b&lt;/CODE&gt; and not &lt;CODE&gt;x&lt;/CODE&gt;, &lt;CODE&gt;y&lt;/CODE&gt; in stats results. &lt;/P&gt;

&lt;P&gt;any help !!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 09:54:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154143#M43303</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T09:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154144#M43304</link>
      <description>&lt;P&gt;You could try and see what your results look like before the &lt;CODE&gt;stats&lt;/CODE&gt; command.&lt;BR /&gt;
What exactly are you trying to achieve with the &lt;CODE&gt;eval&lt;/CODE&gt;? If you want every event to have a url field, you might want to use &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/SearchReference/CommonEvalFunctions"&gt;coalesce&lt;/A&gt; to keep the data that is already in url for those events which don't have uri. If you want to see events where url=uri, you should use &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.2/SearchReference/where"&gt;where&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 09:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154144#M43304</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-04-22T09:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154145#M43305</link>
      <description>&lt;P&gt;hi,&lt;BR /&gt;
try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" or index="xyz" |eval new_field=coalesce(url,uri) |stats values(a),values(b), values(x), values(y) by new_field
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Apr 2015 10:28:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154145#M43305</guid>
      <dc:creator>gyslainlatsa</dc:creator>
      <dc:date>2015-04-22T10:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154146#M43306</link>
      <description>&lt;P&gt;I have url field in index="abc" and uri field in index="xyz" but their values are same , so i am searching for events in both indexes with url field and want to collect a,b,x,y,url in stats.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 10:39:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154146#M43306</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T10:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154147#M43307</link>
      <description>&lt;P&gt;where will not work.. url and uri are different fields with same values across both indexes.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 10:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154147#M43307</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T10:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154148#M43308</link>
      <description>&lt;P&gt;have  you try to work with table commad&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 10:54:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154148#M43308</guid>
      <dc:creator>juvetm</dc:creator>
      <dc:date>2015-04-22T10:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154149#M43309</link>
      <description>&lt;P&gt;i proposed the new answers, try and let me know&lt;BR /&gt;
see above&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 10:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154149#M43309</guid>
      <dc:creator>gyslainlatsa</dc:creator>
      <dc:date>2015-04-22T10:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154150#M43310</link>
      <description>&lt;P&gt;If you really want to use stats, the suggestion from gyslainlatsa is pretty close to what you should do. But maybe you want this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" or index="xyz" |eval url=coalesce(url,uri) |table a, b, c, x, y, z, url
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:13:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154150#M43310</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-04-22T11:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154151#M43311</link>
      <description>&lt;P&gt;Duplicate question from this one: &lt;A href="http://answers.splunk.com/answers/229345/combine-results-from-2-searches-with-a-common-fiel.html"&gt;http://answers.splunk.com/answers/229345/combine-results-from-2-searches-with-a-common-fiel.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;and btw the same answers were provided in here &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;To me, this sounds like there is either no &lt;CODE&gt;url&lt;/CODE&gt; field or no &lt;CODE&gt;y &amp;amp; x&lt;/CODE&gt; field ...... &lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:32:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154151#M43311</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-04-22T11:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154152#M43312</link>
      <description>&lt;P&gt;no table command wnt work.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:37:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154152#M43312</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T11:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154153#M43313</link>
      <description>&lt;P&gt;MuS, there is all these fields&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:39:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154153#M43313</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T11:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154154#M43314</link>
      <description>&lt;P&gt;it is giving field from one index only&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:40:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154154#M43314</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T11:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154155#M43315</link>
      <description>&lt;P&gt;can you provide two of those events in question? Please remove any sensitive data before!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:44:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154155#M43315</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-04-22T11:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154156#M43316</link>
      <description>&lt;P&gt;i got it working with join but it too slow&lt;/P&gt;

&lt;P&gt;index="abc" |eval agt=cs_us| join url [ search index="xyz" | eval url=uri |stats values(a) as a,values(s) as s, by url | fields a,s,url] | stats values(agt) values(a),values(s) by url&lt;/P&gt;

&lt;P&gt;with simple stats&lt;/P&gt;

&lt;P&gt;index=abc OR index=xyz | eval test=coalesce(url, uri)| stats values(a),values(b) by test&lt;/P&gt;

&lt;P&gt;this is only returning values of 'a'. column with values 'b' is coming empty.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:45:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154156#M43316</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T11:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154157#M43317</link>
      <description>&lt;P&gt;simple table command will not work&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:53:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154157#M43317</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T11:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154158#M43318</link>
      <description>&lt;P&gt;There is no "b" in your join search, is that it?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 11:54:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154158#M43318</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-04-22T11:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154159#M43319</link>
      <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" | join url [ search index="xyz" | rename uri as url |stats values(*) as * by url ] | stats values(*)  as  *  by url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc OR index=xyz| rename uri as url  | stats values(*)  as list_of_* by url
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Apr 2015 12:22:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154159#M43319</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2015-04-22T12:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154160#M43320</link>
      <description>&lt;P&gt;that is a typo, it is equivalent to s only.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 12:38:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154160#M43320</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T12:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154161#M43321</link>
      <description>&lt;P&gt;Well, if these two searches both work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc | stats values(a) values(b) by url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xyz | stats values(x) values(y) by uri
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then this search has to do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc OR index=xyz | eval url=coalesce(url, uri) | stats values(a) values (b) values(x) values(y) by url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Of course, if the first search only returns results for two urls (url_1 and url_2) and the second also for two (url_1 and url_3), then the third search will give you three results: one with values for a, b, x and y for url_1, one with a and b for url_2 and one with x and y for url_3. And if either a or b is missing in one of the original results, it won't be in the third search either.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:39:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154161#M43321</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2020-09-28T19:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my stats search on 2 indexes not returning fields from one index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154162#M43322</link>
      <description>&lt;P&gt;exactly my problem, for the third search as mentioned i just want the first result and in that only one index fields are coming. &lt;/P&gt;

&lt;P&gt;Individual searches are working fine over respective indexes.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 13:10:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-stats-search-on-2-indexes-not-returning-fields-from/m-p/154162#M43322</guid>
      <dc:creator>lohit</dc:creator>
      <dc:date>2015-04-22T13:10:04Z</dc:date>
    </item>
  </channel>
</rss>

