<?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 Combine result from 2 queries into same bar chart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474529#M192489</link>
    <description>&lt;P&gt;I see such questions are frequently asked on this forum, but I still don't get a clear picture yet.&lt;/P&gt;

&lt;P&gt;I have my first query &lt;CODE&gt;index=same-index source="same-source" "first-query-static-text" | eval date=strftime(_time, "%Y-%m-%d") | chart count over date&lt;/CODE&gt; and I add it to my dashboard's panel as column chart. Everything is working fine.&lt;/P&gt;

&lt;P&gt;My second query &lt;CODE&gt;index=same-index source="same-source" | regex log="second-query-regex" | eval date=strftime(_time, "%Y-%m-%d") | chart count over date&lt;/CODE&gt; and I add it to my dashboard's panel as column chart. Everything is working fine.&lt;/P&gt;

&lt;P&gt;Now I have to column charts, each from its own query.&lt;/P&gt;

&lt;P&gt;What I want is to have 1 single column chart, each date on x axis has 2 columns (1 value from each query) and use different colours to indicate what is the value for.&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2020 14:36:51 GMT</pubDate>
    <dc:creator>hardywang</dc:creator>
    <dc:date>2020-01-03T14:36:51Z</dc:date>
    <item>
      <title>Combine result from 2 queries into same bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474529#M192489</link>
      <description>&lt;P&gt;I see such questions are frequently asked on this forum, but I still don't get a clear picture yet.&lt;/P&gt;

&lt;P&gt;I have my first query &lt;CODE&gt;index=same-index source="same-source" "first-query-static-text" | eval date=strftime(_time, "%Y-%m-%d") | chart count over date&lt;/CODE&gt; and I add it to my dashboard's panel as column chart. Everything is working fine.&lt;/P&gt;

&lt;P&gt;My second query &lt;CODE&gt;index=same-index source="same-source" | regex log="second-query-regex" | eval date=strftime(_time, "%Y-%m-%d") | chart count over date&lt;/CODE&gt; and I add it to my dashboard's panel as column chart. Everything is working fine.&lt;/P&gt;

&lt;P&gt;Now I have to column charts, each from its own query.&lt;/P&gt;

&lt;P&gt;What I want is to have 1 single column chart, each date on x axis has 2 columns (1 value from each query) and use different colours to indicate what is the value for.&lt;/P&gt;

&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 14:36:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474529#M192489</guid>
      <dc:creator>hardywang</dc:creator>
      <dc:date>2020-01-03T14:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combine result from 2 queries into same bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474530#M192490</link>
      <description>&lt;P&gt;One way to do this would be to give each search result set its own name, and use that for the series. The &lt;CODE&gt;multisearch&lt;/CODE&gt; command may help:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch
[search index=same-index source="same-source" "first-query-static-text" | eval date=strftime(_time, "%Y-%m-%d") | eval seriesName="First"]
[search index=same-index source="same-source" | regex log="second-query-regex" | eval date=strftime(_time, "%Y-%m-%d") | eval seriesName="Second"]
chart count over date by seriesName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't use the &lt;CODE&gt;chart&lt;/CODE&gt; command often, so this might not be solid. Using &lt;CODE&gt;timechart&lt;/CODE&gt; the last line might look like &lt;CODE&gt;| timechart span=1d count by seriesName&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 20:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474530#M192490</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-01-03T20:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combine result from 2 queries into same bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474531#M192491</link>
      <description>&lt;P&gt;Give this a look and see if it is what you are after...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=same-index source="same-source" "first-query-static-text" 
    | bucket _time span=1d 
    | timechart count AS first_query_count 
    | appendcols 
        [ search index=same-index source="same-source" 
        | regex log="second-query-regex" 
        | bucket _time span=1d 
        | timechart count AS second_query_count 
        | fields second_query_count]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jan 2020 21:00:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474531#M192491</guid>
      <dc:creator>mydog8it</dc:creator>
      <dc:date>2020-01-03T21:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: Combine result from 2 queries into same bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474532#M192492</link>
      <description>&lt;P&gt;Your suggestion worked perfectly! I will also explore &lt;CODE&gt;timechart&lt;/CODE&gt; command.&lt;/P&gt;

&lt;P&gt;I am learning splunk, lots to explore.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2020 21:16:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474532#M192492</guid>
      <dc:creator>hardywang</dc:creator>
      <dc:date>2020-01-03T21:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Combine result from 2 queries into same bar chart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474533#M192493</link>
      <description>&lt;P&gt;Once I start to use &lt;CODE&gt;timechart&lt;/CODE&gt; and simplify the query this way, I don't get anything back. Is it a wrong syntax?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch
 [search index=same-index source="same-source" "first-query-static-text" | eval seriesName="First"]
 [search index=same-index source="same-source" | regex log="second-query-regex" | eval seriesName="Second"]
 | timechart span=1d count by seriesName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jan 2020 14:52:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-result-from-2-queries-into-same-bar-chart/m-p/474533#M192493</guid>
      <dc:creator>hardywang</dc:creator>
      <dc:date>2020-01-06T14:52:32Z</dc:date>
    </item>
  </channel>
</rss>

