<?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: multi field in different rows in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313516#M160924</link>
    <description>&lt;P&gt;See my other answer.&lt;/P&gt;</description>
    <pubDate>Mon, 29 May 2017 19:44:26 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-05-29T19:44:26Z</dc:date>
    <item>
      <title>multi field in different rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313512#M160920</link>
      <description>&lt;P&gt;Hi at all,&lt;/P&gt;

&lt;P&gt;I'm ingesting many csv where there are a variable number of columns.&lt;/P&gt;

&lt;P&gt;some of this columns have name "service_0_name", "service_1_name", ..., "service_45_name".&lt;BR /&gt;
Not all these fields are full, but  if there's a value in e.g. "service_3_name", there are values also in "service_0_name", "service_1_name" and "service_2_name".&lt;BR /&gt;
I need a field with all service_x_name values to manage with mvexpand.&lt;BR /&gt;
In other word something like coalesce(field1, field2, ...) that takes all values and not only the first.&lt;/P&gt;

&lt;P&gt;Anyone has an idea how to solve this problem?&lt;/P&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;

&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:13:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313512#M160920</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T14:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: multi field in different rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313513#M160921</link>
      <description>&lt;P&gt;Assuming there is one key field and all other fields/columns are &lt;CODE&gt;service_*&lt;/CODE&gt; (if there isn't, just add &lt;CODE&gt;| eval host="LabelHere"&lt;/CODE&gt; before the rest of the solution), then this will work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | untable host services count | stats values(services)  AS service_values list(services) AS service_list BY host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note, this will only work for 1000 values because that is the limit for &lt;CODE&gt;values&lt;/CODE&gt; and &lt;CODE&gt;list&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 14:05:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313513#M160921</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-29T14:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: multi field in different rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313514#M160922</link>
      <description>&lt;P&gt;Hi Woodcoock,&lt;BR /&gt;
sorry but I don't understand the untable command:&lt;/P&gt;

&lt;P&gt;I have in each row:&lt;BR /&gt;
_time uid other_fields service_0_name service_1_name service_2_name ...&lt;BR /&gt;
and values of service_x_name are strings (as tcp, telnet, ftp, ....)&lt;/P&gt;

&lt;P&gt;I need to have all these strings fo each row.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313514#M160922</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T14:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: multi field in different rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313515#M160923</link>
      <description>&lt;P&gt;Let's assume that you have exactly these fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time uid other fields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Along with your huge list of fields like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;service_0_name service_1_name service_2_name ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In order to use &lt;CODE&gt;untable&lt;/CODE&gt;, you to have exactly 1 "other" field so you need to combine and reduce your "non-service" fields into a single "other" field, do the "service" stuff, then extract the "other" fields back out like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval time_uid_other_fields = _time . "::" . uid . "::" . other . "::" . fields
| table time_uid_other_fields service_*
| untable time_uid_other_fields services count
| stats values(services)  AS service_values list(services) AS service_list BY time_uid_other_fields
| rex field=time_uid_other_fields "^(?&amp;lt;_time&amp;gt;.*?)::(?&amp;lt;uid&amp;gt;.*?)::(?&amp;lt;other&amp;gt;.*?)::(?&amp;lt;fields&amp;gt;.*?)$"
| fields - time_uid_other_fields 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note, this will only work for 1000 values because that is the limit for values and list.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 19:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313515#M160923</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-29T19:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: multi field in different rows</title>
      <link>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313516#M160924</link>
      <description>&lt;P&gt;See my other answer.&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 19:44:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/multi-field-in-different-rows/m-p/313516#M160924</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-29T19:44:26Z</dc:date>
    </item>
  </channel>
</rss>

