<?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: Reformat data into 2 dimensional table for charting in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346186#M102547</link>
    <description>&lt;P&gt;This is exactly what I was looking for!  Thank you!!!&lt;/P&gt;</description>
    <pubDate>Wed, 02 Aug 2017 18:46:51 GMT</pubDate>
    <dc:creator>kmaron</dc:creator>
    <dc:date>2017-08-02T18:46:51Z</dc:date>
    <item>
      <title>Reformat data into 2 dimensional table for charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346182#M102543</link>
      <description>&lt;P&gt;I keep going around in circles with this and I'm getting nowhere so I'm asking for help. &lt;/P&gt;

&lt;P&gt;My events look like this:&lt;/P&gt;

&lt;P&gt;2017-08-02 12:43:25.707, CE_OPERATIONS_COMPONENT="1", AO_OPERATIONS_COMPONENT="5", WSREQUEST_COMPONENT="0", DELAY_COMPONENT="2"&lt;BR /&gt;
source =    CLAIMSTG-PROD&lt;/P&gt;

&lt;P&gt;2017-08-02 12:43:25.689, CE_OPERATIONS_COMPONENT="0", AO_OPERATIONS_COMPONENT="2",  WSREQUEST_COMPONENT="0", DELAY_COMPONENT="3"&lt;BR /&gt;
source =    LIFETG-PROD&lt;/P&gt;

&lt;P&gt;2017-08-02 12:43:25.689, CE_OPERATIONS_COMPONENT="4", AO_OPERATIONS_COMPONENT="0",  WSREQUEST_COMPONENT="1", DELAY_COMPONENT="0"&lt;BR /&gt;
source =    FSCDTG-PROD&lt;/P&gt;

&lt;P&gt;When I do stats on them I can do Source on the left, then the component field names across the top and the values as the cells. &lt;BR /&gt;
What I really would like would be a table like one of these: &lt;IMG src="https://community.splunk.com/storage/temp/207007-queuecounttables.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;But I can't seem to figure out how to move the field names into a field value or something to do this.&lt;BR /&gt;
Maybe there's another way? Or a way to shift things around?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:11:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346182#M102543</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2020-09-29T15:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat data into 2 dimensional table for charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346183#M102544</link>
      <description>&lt;P&gt;@kmaron, what the current output and expected output?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 18:05:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346183#M102544</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-08-02T18:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat data into 2 dimensional table for charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346184#M102545</link>
      <description>&lt;P&gt;The current output is a table with Source on the left, then the component field names across the top and the values as the cells.&lt;/P&gt;

&lt;P&gt;Expected output is the image I shared with Source in the left column, component name in the second column and the values in the right hand column. &lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 18:10:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346184#M102545</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2017-08-02T18:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat data into 2 dimensional table for charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346185#M102546</link>
      <description>&lt;P&gt;You are looking for the &lt;CODE&gt;untable&lt;/CODE&gt; command.  See &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Untable"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Untable&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This run anywhere sample creates a test table ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval mydata="foo,mike,1 foo,jim,3 foo,babs,7 bar,jim,4 bar,babs,3 bar,jimmy,4"
| makemv mydata 
| mvexpand mydata 
| rex field=mydata "(?&amp;lt;source&amp;gt;[^,]*),(?&amp;lt;salesman&amp;gt;[^,]*),(?&amp;lt;salescount&amp;gt;\d+)"
| chart sum(salescount) as count over salesman by source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...which looks like this... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;salesman    bar   foo
babs        3      7  
jim         4      3  
jimmy       4    
mike               1  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now that we've doen all that work to get sample stuff, here's your command...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | untable salesman source count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...which reformats the above table result to this... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;salesman source count   
babs     bar     3  
babs     foo     7  
jim      bar     4  
jim      foo     3  
jimmy    bar     4  
mike     foo     1  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that in the &lt;CODE&gt;untable&lt;/CODE&gt; command, the first argument must be a real field name, and the next two are arbitrary.  The second is the place the column field name will GO, and the third is the place that that column field's value will go.&lt;/P&gt;

&lt;P&gt;Now, if you feed the  output of &lt;CODE&gt;untable&lt;/CODE&gt; straight back into the &lt;CODE&gt;xyseries&lt;/CODE&gt; command with the exact same arguments, it will put your table back exactly the way it was.  (unless there were size limits or other issues...)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | xyseries salesman source count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Xyseries"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Xyseries&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 18:31:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346185#M102546</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-02T18:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reformat data into 2 dimensional table for charting</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346186#M102547</link>
      <description>&lt;P&gt;This is exactly what I was looking for!  Thank you!!!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 18:46:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Reformat-data-into-2-dimensional-table-for-charting/m-p/346186#M102547</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2017-08-02T18:46:51Z</dc:date>
    </item>
  </channel>
</rss>

