<?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: Add column value of matching fields in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370821#M40147</link>
    <description>&lt;P&gt;are you doing &lt;CODE&gt;stats values(rotton_time) as rotten_time by fruit&lt;/CODE&gt; before streamstats command?&lt;BR /&gt;
because streamstats works on events in order to show it in table you need to first get that table as an input to this command.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jan 2018 10:34:25 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-01-03T10:34:25Z</dc:date>
    <item>
      <title>Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370811#M40137</link>
      <description>&lt;P&gt;The table output of my Splunk search gives me an output like this.&lt;BR /&gt;
There are two columns "fruit" and "rotten_time".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;fruit | rotten_time
nyf   | 97 sec
mse   | 16 sec
sem   | 20 sec
ert   | 33 sec
dhg   | 21 sec
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want a "add column value" of the column rotten_time, but it shouldn't add all the values. It should only add if the corresponding fruit value starts with 'mse' and ends with 'ert'. That mean it should only add 16+20+33&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 08:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370811#M40137</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-01-03T08:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370812#M40138</link>
      <description>&lt;P&gt;hey try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base_search_which_gives_table_output i.e. stats values(rotton_time) as rotten_time by fruit 
| rex field=rotten_time "(?P&amp;lt;rotten_time&amp;gt;\d+)" 
| streamstats sum(rotten_time) as sum_between_mse_&amp;amp;_ert reset_before="("fruit==\"mse\"")" reset_after="("fruit==\"ert\"")" reset_on_change=true 
| search fruit=ert 
| fields sum_between_mse_&amp;amp;_ert
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps you!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 09:29:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370812#M40138</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T09:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370813#M40139</link>
      <description>&lt;P&gt;Just as you know, there is no pipe symbol (|) between the column fruit and rotten_time. They are two separate columns . I have added them pipe mark to separete them for understanding  here in the  forum.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 09:37:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370813#M40139</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-01-03T09:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370814#M40140</link>
      <description>&lt;P&gt;I get an error &lt;BR /&gt;
"Error in 'streamstats' command: The argument 'sum_between_/mse/tup/1_&amp;amp;_/ert/tup/2' is invalid."&lt;/P&gt;

&lt;P&gt;Also, my fruit names are little bit complex. It is not just "mse". It is rather &lt;STRONG&gt;/mse/tup/1&lt;/STRONG&gt;.&lt;BR /&gt;
Similarly "ert" is actually &lt;STRONG&gt;/ert/tup/2&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;
So i tried to encapsulate them in double quotes, yet I got the error.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370814#M40140</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-09-29T17:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370815#M40141</link>
      <description>&lt;P&gt;yes i have considered both of them as separate columns only &lt;/P&gt;

&lt;P&gt;try this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base_search_which_gives_table_output i.e. stats values(rotton_time) as rotten_time by fruit 
| rex field=rotten_time "(?P&amp;lt;rotten_time&amp;gt;\d+)" 
| streamstats sum(rotten_time) as "sum_between_/mse/tup/1_&amp;amp;_/ert/tup/2" reset_before="("sourcetype==\"/mse/tup/1\"")" reset_after="("sourcetype==\"/ert/tup/2\"")" reset_on_change=true 
| search fruit="/ert/tup/2" 
| fields "sum_between_/mse/tup/1_&amp;amp;_/ert/tup/2"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 09:58:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370815#M40141</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T09:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370816#M40142</link>
      <description>&lt;P&gt;also if you get an error with this search please show me your query as this query I have tested and its working fine at my end!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:01:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370816#M40142</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T10:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370817#M40143</link>
      <description>&lt;P&gt;It runs now without any error.&lt;BR /&gt;
But I am not able to see my result (of sum). In the statistics tab it doesn't show anything..&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:11:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370817#M40143</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-01-03T10:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370818#M40144</link>
      <description>&lt;P&gt;try to troubleshoot at which point you are not getting results start with the first pipe and see results. if you are getting results then add the second query to second pipe like this check for every pipe results and see at which point you are not getting results for eg.&lt;BR /&gt;
check for below query if you are getting output and then add next query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base_search_which_gives_table_output i.e. stats values(rotton_time) as rotten_time by fruit 
 | rex field=rotten_time "(?P&amp;lt;rotten_time&amp;gt;\d+)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:17:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370818#M40144</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T10:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370819#M40145</link>
      <description>&lt;P&gt;as you are not getting any error then one of the search is filtering out your events !&lt;BR /&gt;
so tell me at after hitting which command you are not getting results.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:22:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370819#M40145</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T10:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370820#M40146</link>
      <description>&lt;P&gt;I am getting the output (in the events tab). It's just not in a tabular format or graphs to be able to see in the Statistics or Visualization tab.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:24:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370820#M40146</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-01-03T10:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370821#M40147</link>
      <description>&lt;P&gt;are you doing &lt;CODE&gt;stats values(rotton_time) as rotten_time by fruit&lt;/CODE&gt; before streamstats command?&lt;BR /&gt;
because streamstats works on events in order to show it in table you need to first get that table as an input to this command.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370821#M40147</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T10:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370822#M40148</link>
      <description>&lt;P&gt;can you give me what output you get &lt;CODE&gt;stats values(rotton_time) as rotten_time by fruit&lt;/CODE&gt;&lt;BR /&gt;
command&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:35:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370822#M40148</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T10:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370823#M40149</link>
      <description>&lt;P&gt;I added ,&lt;BR /&gt;
| stats values(rotten_time) as rotten_time by fruit&lt;BR /&gt;
between the rex fields line and streamstats line.and before the rex field I have the table command whose output I had originally posted.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:28:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370823#M40149</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-09-29T17:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370824#M40150</link>
      <description>&lt;P&gt;I ran the stats values(rotton_time) as rotten_time by fruit .&lt;BR /&gt;
and it shows me a table with two coumns . fruit and rotten_time.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:28:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370824#M40150</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2020-09-29T17:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370825#M40151</link>
      <description>&lt;P&gt;so after doing rex you are getting &lt;CODE&gt;sec&lt;/CODE&gt; is removed right? i.e you are getting numerical values i.e. 20 16 30?&lt;BR /&gt;
if you getting these values then just &lt;CODE&gt;| stats sum(rotten_time)&lt;/CODE&gt; &lt;BR /&gt;
just to see if stats command is working after rex or not.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:50:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370825#M40151</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T10:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370826#M40152</link>
      <description>&lt;P&gt;I see in fruit, the /ert/tup/2 value is a bit different.&lt;BR /&gt;
Sometime the value is /ert/tup/2?=4 , other time it is /ert/tup/2?=7, /ert/tup/2?=3 etc,,,&lt;BR /&gt;
Can I replace the /ert/tup/2 keywords as this  &lt;STRONG&gt;/ert/tup/2?=&lt;/STRONG&gt;*   ?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370826#M40152</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-01-03T10:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370827#M40153</link>
      <description>&lt;P&gt;In my base query itself I have removed the sec now. Now my query gives only numeric figure , with out the 'sec' appended to it. &lt;BR /&gt;
Does this mean, is it okay to remove the rex statement from the query ?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:52:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370827#M40153</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-01-03T10:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370828#M40154</link>
      <description>&lt;P&gt;okay so if you have removed sec then remove rex (rex command i have used to remove sec) then try running streamstats command after stats command which I gave to you and see the output you get &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 10:55:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370828#M40154</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T10:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370829#M40155</link>
      <description>&lt;P&gt;I kept until streamstats command and remove that last two lines. &lt;BR /&gt;
It seems to give me some result.&lt;BR /&gt;
What were the role of the last two lines ? Will it impact anything that I'm looking for ? and what about the ert thing .... as per different queries /ert .. thing gives different value. &lt;BR /&gt;
Is it okay to do something like this (/ert/tup/2?=*), I mean putting an asterisk in the changing value part ?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 11:06:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370829#M40155</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2018-01-03T11:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add column value of matching fields</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370830#M40156</link>
      <description>&lt;P&gt;see i am assuming that you have only one mse and only one ert after streamstats command you will get output like &lt;BR /&gt;
stats ouput&lt;BR /&gt;
fruit | rotten_time&lt;BR /&gt;
nyf| 97&lt;BR /&gt;
mse | 16&lt;BR /&gt;
sem | 20&lt;BR /&gt;
ert | 33&lt;BR /&gt;
dhg | 21&lt;/P&gt;

&lt;P&gt;streamstats output &lt;BR /&gt;
fruit | rotten_time&lt;BR /&gt;
nyf| 97 &lt;BR /&gt;
mse | 16&lt;BR /&gt;
sem | 36&lt;BR /&gt;
ert | 69 &lt;BR /&gt;
dhg | 21&lt;BR /&gt;
69 is the output you want. just check theoutput of streamstats command is getting adding ?&lt;BR /&gt;
so mse to ert the sum is 69 in order to display only 69 i have written last two lines!&lt;BR /&gt;
see the output of streamstats and look the sum &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2018 11:27:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Add-column-value-of-matching-fields/m-p/370830#M40156</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-03T11:27:33Z</dc:date>
    </item>
  </channel>
</rss>

