<?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: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198586#M57439</link>
    <description>&lt;P&gt;Hi alterdego,&lt;/P&gt;

&lt;P&gt;Thanks a lot for your answer, i think too this should do the trick.&lt;/P&gt;

&lt;P&gt;The #3 is little bit different from my data, my fields are arbitrary (and i can't know them in advance), like:&lt;/P&gt;

&lt;P&gt;timestamp 00:45:ER 00:76:23 (csv header)&lt;BR /&gt;
06/16/2014,00:00:00 0 0 (timestamp + value for each corresponding field)&lt;/P&gt;

&lt;P&gt;I'm trying to adapt the example to my case...&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jun 2014 17:41:59 GMT</pubDate>
    <dc:creator>guilmxm</dc:creator>
    <dc:date>2014-06-16T17:41:59Z</dc:date>
    <item>
      <title>variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198584#M57437</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have data indexed with variable fields (csv data indexed as csv by Splunk) such as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timestamp device1 device2 device3 device4
XXXXXXXX        X       X       X       X
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where X are timestamps and values.&lt;/P&gt;

&lt;P&gt;I would like to transform these data with Splunk to get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timestamp device value
XXXXXXXXX device1    X
XXXXXXXXX device2    X
XXXXXXXXX device3    X
XXXXXXXXX device4    X
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Currently, I can manipulate data to stats and chart them using:&lt;/P&gt;

&lt;P&gt;&lt;SEARCH stuff=""&gt; | timechart max(*) As *&lt;/SEARCH&gt;&lt;/P&gt;

&lt;P&gt;Then i can filter by fields name or doing any other operation.&lt;/P&gt;

&lt;P&gt;But i would like to aggregate them (sum) by time interval, easy when devices are arranged in uniq fields, more complicated with variable fields i can't know in advance.&lt;/P&gt;

&lt;P&gt;I found a way to stats count/max or whatever by device, but i can't get to include time:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search stuff&amp;gt;
| stats max(*) As *
| transpose
| rex device=device^count\((?&amp;lt;column&amp;gt;.*?)\)
| rename column as device | rename "row 1" as value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would have like the same kind of stuff to include the timestamp with the goal to re-arrange the data&lt;/P&gt;

&lt;P&gt;Thank you very much for any help !&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 09:00:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198584#M57437</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-06-16T09:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198585#M57438</link>
      <description>&lt;P&gt;Your example, and the result you are looking, for is almost the exact example (#3) used in the Search Reference manual for the mvexpand command.&lt;/P&gt;

&lt;P&gt;Please take a look: &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mvexpand"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mvexpand&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 14:05:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198585#M57438</guid>
      <dc:creator>alterdego</dc:creator>
      <dc:date>2014-06-16T14:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198586#M57439</link>
      <description>&lt;P&gt;Hi alterdego,&lt;/P&gt;

&lt;P&gt;Thanks a lot for your answer, i think too this should do the trick.&lt;/P&gt;

&lt;P&gt;The #3 is little bit different from my data, my fields are arbitrary (and i can't know them in advance), like:&lt;/P&gt;

&lt;P&gt;timestamp 00:45:ER 00:76:23 (csv header)&lt;BR /&gt;
06/16/2014,00:00:00 0 0 (timestamp + value for each corresponding field)&lt;/P&gt;

&lt;P&gt;I'm trying to adapt the example to my case...&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 17:41:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198586#M57439</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-06-16T17:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198587#M57440</link>
      <description>&lt;P&gt;If you have any idea how, don't hesitate please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I'm quite bad with mvexpand, multikv, makekv and so on... and i often have the same kind of need without being able as for now to manage it.. which drives me crasy !&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 18:28:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198587#M57440</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-06-16T18:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198588#M57441</link>
      <description>&lt;P&gt;what version of Splunk are your using ? In the example for mvexpand, the rex command will not work for your data but , if you're on Splunk 6.x, then rex functionality can be achieved by foreach.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 20:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198588#M57441</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-06-16T20:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198589#M57442</link>
      <description>&lt;P&gt;See if this works (from your stats max query in the question)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search stuff&amp;gt; | eval MaxTime=_time | stats max(*) As *
| transpose  | appendpipe [| where column="MaxTime" | rename "row 1" as Timestamp] | eventstats max(Timestamp) as Timestamp | where like(column,"device%") | convert ctime(Timestamp) | rename column as device, "row 1" as value | table Timestamp, device, value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Jun 2014 20:56:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198589#M57442</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-06-16T20:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198590#M57443</link>
      <description>&lt;P&gt;Hi somesoni2,&lt;/P&gt;

&lt;P&gt;Many thanks for your answer ! And i confirm this works great &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I had an another solution (thanks to to madscient) using untable which is a little bit more simple and works great too, i'll comment this post with both solutions&lt;/P&gt;

&lt;P&gt;But really thank you for this!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 06:02:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198590#M57443</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-06-17T06:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198591#M57444</link>
      <description>&lt;P&gt;For people having the same requirement of re-arranging data with multiple arbitrary fields, 2 solutions answered to it, thanks to somesoni2 and madscient:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;1. using eventstat:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search stuff&amp;gt; | eval MaxTime=_time | stats max(*) As *
| transpose  | appendpipe [| where column="MaxTime" | rename "row 1" as Timestamp] | eventstats max(Timestamp) as Timestamp | where like(column,"device%") | convert ctime(Timestamp) | rename column as device, "row 1" as value | table Timestamp, device, value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Works great&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;2. Simpler solution using untable&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search stuff&amp;gt; | stats max(*) As * by _time | untable _time device value | stats max(value) as value by device
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Works great&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 06:07:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198591#M57444</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-06-17T06:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198592#M57445</link>
      <description>&lt;P&gt;This is (2nd solution) amazing. Good to learn a new command. Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 13:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198592#M57445</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-06-17T13:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198593#M57446</link>
      <description>&lt;P&gt;Yes it is, this works incredibly great!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 15:10:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198593#M57446</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-06-17T15:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: variable fields - re-arrange (tranpose) variables fields into one field for data aggregation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198594#M57447</link>
      <description>&lt;P&gt;Thanks to Nick !&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 15:10:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/variable-fields-re-arrange-tranpose-variables-fields-into-one/m-p/198594#M57447</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-06-17T15:10:55Z</dc:date>
    </item>
  </channel>
</rss>

