<?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: How to create dynamic columns based on calculated data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367155#M108313</link>
    <description>&lt;P&gt;Yes, in that case, you are absolutely correct.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2017 23:17:43 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-03-20T23:17:43Z</dc:date>
    <item>
      <title>How to create dynamic columns based on calculated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367149#M108307</link>
      <description>&lt;P&gt;I have transaction records that are pretty clear.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OperationType=singon Client=abc IsSuccess=1
OperationType=changePassword Client=xyz IsSuccess=0
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Based on these records I want to see the success % rate by OperationType and Client&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mydata | stats count as Total, sum(IsSuccess) as Succeeded by OperationType, Client | eval SuccessRate=(Succeeded/Total)*100  | fields - Total, Succeeded
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That outputs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OperationType | Client | SuccessRate
signon        | abc    | 95
signon        | xyz    | 97
changepassword| abc    | 89
changepassword| xyz    | 93
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This creates a lot of rows, one for every Client, OperationType combination.  Instead, I'd like the chart to have a column for every client and a row for each OperationType like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OperationType | abc | xyz 
signon        | 95  | 97
changepassword| 89  | 93
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any idea how to approach this?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 01:09:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367149#M108307</guid>
      <dc:creator>FeatureCreeep</dc:creator>
      <dc:date>2017-03-20T01:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic columns based on calculated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367150#M108308</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mydata | stats count AS Total sum(IsSuccess) AS Succeeded BY OperationType Client | eval SuccessRate=(Succeeded/Total)*100  | fields - Total, Succeeded | chart Avg(SuccessRate) AS SuccessRate BY OperationType Client
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2017 01:19:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367150#M108308</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-20T01:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic columns based on calculated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367151#M108309</link>
      <description>&lt;P&gt;Thanks.  Worked like a charm.  I guess I need to spend more time reading up on stats vs chart.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 01:44:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367151#M108309</guid>
      <dc:creator>FeatureCreeep</dc:creator>
      <dc:date>2017-03-20T01:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic columns based on calculated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367152#M108310</link>
      <description>&lt;P&gt;It seems strange and confusing to do a chart on the end here instead of xyseries.   the chart command here is calculating average successrate for each unique combination of OperationType and Client. However the stats command before it guarantees that there will be only one such row for each such combination.  So it takes the average of 1 record.   Which ends up working out OK, but it's very confusing.   It seems a less confusing way to get the same end result is to do this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mydata | stats count AS Total sum(IsSuccess) AS Succeeded BY OperationType Client | eval SuccessRate=(Succeeded/Total)*100  | xyseries OperationType Client SuccessRate
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2017 18:18:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367152#M108310</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2017-03-20T18:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic columns based on calculated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367153#M108311</link>
      <description>&lt;P&gt;You are quite correct EXCEPT if the data in the file is not as unique as it appears that it should be.  If we know it is 1-to-1 then &lt;CODE&gt;xyseries&lt;/CODE&gt; will be slightly more direct/efficient.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 20:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367153#M108311</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-20T20:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic columns based on calculated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367154#M108312</link>
      <description>&lt;P&gt;coming out of the stats command,  the &lt;CODE&gt;BY OperationType Client&lt;/CODE&gt; in the stats command will guarantee that no matter what the events look like, there will only one row coming out per combination of OperationType and Client.   Therefore each row coming into the other chart command will have precisely one row per unique combination of OperationType and Client.   That's what I meant.   &lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 22:37:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367154#M108312</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2017-03-20T22:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dynamic columns based on calculated data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367155#M108313</link>
      <description>&lt;P&gt;Yes, in that case, you are absolutely correct.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 23:17:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-dynamic-columns-based-on-calculated-data/m-p/367155#M108313</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-20T23:17:43Z</dc:date>
    </item>
  </channel>
</rss>

