<?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 concatenate  a variable number of fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482404#M135152</link>
    <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=_raw "a\d+\=+\"(?&amp;lt;y&amp;gt;.*?)\"" max_match=0|table argc,y| eval combo=mvjoin(y, "")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;assumption - your vaues always start with a followed by digit, like a0,a1...a[n]&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2019 12:32:29 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2019-09-16T12:32:29Z</dc:date>
    <item>
      <title>How to concatenate  a variable number of fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482403#M135151</link>
      <description>&lt;P&gt;I had the next events examples:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-09-16T13:27:10.169107+02:00 koopa.browser.local node= koopa.browser.local  type=EXECVE msg=audit(15687332450.174:771277): argc=2 a0="cat" a1="/proc/cmdline"

2019-09-16T13:27:10.169107+02:00 koopa.browser.local node= koopa.browser.local  type=EXECVE msg=audit(15687123450.174:123277): argc=3 a0="/bin/systemctl" a1="status" a2="ntpd.service"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to concatenate de fields a0, a1, a2, a3... etc, but it isn't a fixed number of fields. Can I concatenate a variable number of fields defined by argc field?&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 11:57:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482403#M135151</guid>
      <dc:creator>rafadvega</dc:creator>
      <dc:date>2019-09-16T11:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate  a variable number of fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482404#M135152</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=_raw "a\d+\=+\"(?&amp;lt;y&amp;gt;.*?)\"" max_match=0|table argc,y| eval combo=mvjoin(y, "")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;assumption - your vaues always start with a followed by digit, like a0,a1...a[n]&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 12:32:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482404#M135152</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-09-16T12:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate  a variable number of fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482405#M135153</link>
      <description>&lt;P&gt;works! you are f...king monster. Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 13:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482405#M135153</guid>
      <dc:creator>rafadvega</dc:creator>
      <dc:date>2019-09-16T13:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate  a variable number of fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482406#M135154</link>
      <description>&lt;P&gt;I think it's more correct to say that the values always start with "a" followed by an integer. Your regex matches 1 or more digits, found by one or more = signs, followed by a literal double-quote character, etc.&lt;/P&gt;

&lt;P&gt;My guess is that we don't want the "+" after the "=" sign; it's spurious in any event and it could be a little misleading.&lt;/P&gt;

&lt;P&gt;I think the correct regex would look like this:  &lt;CODE&gt;"a\d+=\"(?&amp;lt;y&amp;gt;.*?)\""&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You don't need the backslash in front of the = sign, as it's not a metacharacter, but if you want to do it as a matter of style it won't hurt anything.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 18:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-a-variable-number-of-fields/m-p/482406#M135154</guid>
      <dc:creator>schwagem</dc:creator>
      <dc:date>2019-12-19T18:41:37Z</dc:date>
    </item>
  </channel>
</rss>

