<?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 replace space in multi-value field with comma in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/replace-space-in-multi-value-field-with-comma/m-p/101744#M26281</link>
    <description>&lt;P&gt;Hi.&lt;/P&gt;

&lt;P&gt;i have field input_source_file and I need to make it a comma separated field so that I can group by that and source and get a count, i followed the thread "&lt;A href="http://splunk-base.splunk.com/answers/79030/replace-space-in-multi-value-filed-with-comma" target="_blank"&gt;http://splunk-base.splunk.com/answers/79030/replace-space-in-multi-value-filed-with-comma&lt;/A&gt;" but not able to get the result.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;data in input_source_file&lt;/STRONG&gt; is : aaaa bbbb&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;desired&lt;/STRONG&gt;: aaaa,bbbb&lt;/P&gt;

&lt;P&gt;My query is:&lt;/P&gt;

&lt;P&gt;sourcetype="mslogs" ("MPSVCCMN_10081" OR "DBG_21430") earliest="12/5/2012:16:08:00" latest="12/5/2013:16:16:00" | rex field=_raw "Mapping service is running [(?&lt;MAPPING&gt;(.+))]sdep" | transaction source|search mapping_name=xxxx| rex mode=sed field=input_source_file "s/ /,/g" | stats count(source) by mapping_name,input_source_file&lt;/MAPPING&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;sample event:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;2012-12-05 20:19:17 INFO: [MPSVCCMN_10081] Mapping service is running [xxxx] deployed in [yyyy]&lt;/P&gt;

&lt;P&gt;2012-12-05 20:19:17 INFO: READER_1_1_1, DBG_21430,  Reading data from input source file [aaaa]&lt;/P&gt;

&lt;P&gt;2012-12-05 20:19:17 INFO: READER_1_2_1, DBG_21430,  Reading data from input source file [bbbb]&lt;/P&gt;

&lt;P&gt;please advice&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:24:05 GMT</pubDate>
    <dc:creator>trkalva</dc:creator>
    <dc:date>2020-09-28T14:24:05Z</dc:date>
    <item>
      <title>replace space in multi-value field with comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/replace-space-in-multi-value-field-with-comma/m-p/101744#M26281</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;

&lt;P&gt;i have field input_source_file and I need to make it a comma separated field so that I can group by that and source and get a count, i followed the thread "&lt;A href="http://splunk-base.splunk.com/answers/79030/replace-space-in-multi-value-filed-with-comma" target="_blank"&gt;http://splunk-base.splunk.com/answers/79030/replace-space-in-multi-value-filed-with-comma&lt;/A&gt;" but not able to get the result.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;data in input_source_file&lt;/STRONG&gt; is : aaaa bbbb&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;desired&lt;/STRONG&gt;: aaaa,bbbb&lt;/P&gt;

&lt;P&gt;My query is:&lt;/P&gt;

&lt;P&gt;sourcetype="mslogs" ("MPSVCCMN_10081" OR "DBG_21430") earliest="12/5/2012:16:08:00" latest="12/5/2013:16:16:00" | rex field=_raw "Mapping service is running [(?&lt;MAPPING&gt;(.+))]sdep" | transaction source|search mapping_name=xxxx| rex mode=sed field=input_source_file "s/ /,/g" | stats count(source) by mapping_name,input_source_file&lt;/MAPPING&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;sample event:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;2012-12-05 20:19:17 INFO: [MPSVCCMN_10081] Mapping service is running [xxxx] deployed in [yyyy]&lt;/P&gt;

&lt;P&gt;2012-12-05 20:19:17 INFO: READER_1_1_1, DBG_21430,  Reading data from input source file [aaaa]&lt;/P&gt;

&lt;P&gt;2012-12-05 20:19:17 INFO: READER_1_2_1, DBG_21430,  Reading data from input source file [bbbb]&lt;/P&gt;

&lt;P&gt;please advice&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/replace-space-in-multi-value-field-with-comma/m-p/101744#M26281</guid>
      <dc:creator>trkalva</dc:creator>
      <dc:date>2020-09-28T14:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: replace space in multi-value field with comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/replace-space-in-multi-value-field-with-comma/m-p/101745#M26282</link>
      <description>&lt;P&gt;Simply replacing the spaces with commas does not create a multi-valued field. So the &lt;CODE&gt;rex&lt;/CODE&gt; command may have worked, but the rest of your search needs to be fixed. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="mslogs" ("MPSVCCMN_10081" OR "DBG_21430") earliest="12/5/2012:16:08:00" latest="12/5/2013:16:16:00" 
| rex field=_raw "Mapping service is running [(?&amp;lt;mapping&amp;#2;&amp;#3;name&amp;gt;(.+))]sdep" 
| transaction source
| search mapping_name=xxxx
| rex mode=sed field=input_source_file "s/ /,/g" 
| makemv delim="," input_source_file
| stats count by mapping_name, input_source_file
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, note that you are not counting by &lt;CODE&gt;source&lt;/CODE&gt;, you are only counting events that have a field named &lt;CODE&gt;source&lt;/CODE&gt;, which is all events. So I removed that part of the &lt;CODE&gt;stats&lt;/CODE&gt; command.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2013 00:39:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/replace-space-in-multi-value-field-with-comma/m-p/101745#M26282</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-07-21T00:39:45Z</dc:date>
    </item>
  </channel>
</rss>

