<?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: Help with mvcombine needed in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491237#M8847</link>
    <description>&lt;P&gt;Can you not just swap out &lt;CODE&gt;| mvcombine LINE&lt;/CODE&gt; for &lt;CODE&gt;| stats list(LINE) AS LINE BY some other fields maybe here&lt;/CODE&gt;?&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 23:42:57 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-11-20T23:42:57Z</dc:date>
    <item>
      <title>Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491228#M8838</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following case:&lt;BR /&gt;
- In my SPL, based on the output of the dbx SQL queries executed over the map command, I am building the column LINE, which basically has result of the SQLs. Now, I want to present this output in the alert text. For this I need to address the LINE over $result.LINE$. The issue is, that I am getting only the first row of LINE column into the alert result.&lt;BR /&gt;
My workaround for that is that I am using mvcombine over the LINE column, which assembles all rows together into one, works fine.&lt;BR /&gt;
The only problem I have is, that the emtpty rows (well, they consist of many space characters) get chopped off by the mvcombine. Unfortunately I need them because I use them as the text formatting for the alert text.&lt;/P&gt;

&lt;P&gt;How would I overcome the issue?&lt;BR /&gt;
below the SPL and the screenshot of the result with and without mvcombine&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Kamil&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults

| eval SID = "BWP"
| eval HOST = "ls5923"

| eval SQL = "CPU_HEADLINE"
| lookup datafetch_sql_texts2.csv SQL output SQL_TEXT as CPU_HEADLINE
| eval SQL = "CPU_HEADLINE_BWP"
| lookup datafetch_sql_texts2.csv SQL output SQL_TEXT as CPU_HEADLINE_BWP
| eval SQL = "CPU_DEATILS_BWP"
| lookup datafetch_sql_texts.csv SQL output SQL_TEXT as CPU_DEATILS_BWP
| eval SQL = "MEM_HEADLINE"
| lookup datafetch_sql_texts2.csv SQL output SQL_TEXT as MEM_HEADLINE
| eval SQL = "MEM_BWP"
| lookup datafetch_sql_texts.csv SQL output SQL_TEXT as MEM_BWP

| eval CPU_HEADLINE_BWP = replace(CPU_HEADLINE_BWP,"x22", "\"")
| eval CPU_HEADLINE_BWP = replace(CPU_HEADLINE_BWP,"ML_HOST", HOST)
| eval CPU_HEADLINE_BWP = replace(CPU_HEADLINE_BWP,"ML_SID", SID)

| eval CPU_DEATILS_BWP = replace(CPU_DEATILS_BWP,"x22", "\"")
| eval CPU_DEATILS_BWP = replace(CPU_DEATILS_BWP,"ML_HOST", HOST)
| eval CPU_DEATILS_BWP = replace(CPU_DEATILS_BWP,"ML_SID", SID)

| eval MEM_BWP = replace(MEM_BWP,"x22", "\"")
| eval MEM_BWP = replace(MEM_BWP,"ML_HOST", HOST)
| eval MEM_BWP = replace(MEM_BWP,"ML_SID", SID)

 |rename comment AS " *********************************** Evaluate the RCA ***********************************************  "
| eval RCA = "Missing Data MEMORY_USED , CPU"
| eval CPU_HEADLINE_BWP = if(like(RCA, "%CPU%"), CPU_HEADLINE_BWP, "")
| eval CPU_HEADLINE = if(like(RCA, "%CPU%"), CPU_HEADLINE, "")
| eval CPU_DEATILS_BWP = if(like(RCA, "%CPU%"), CPU_DEATILS_BWP, "")
| eval MEM_HEADLINE = if(like(RCA, "%MEMORY_USED%"), MEM_HEADLINE, "")
| eval MEM_BWP = if(like(RCA, "%MEMORY_USED%"), MEM_BWP, "")


 |rename comment AS " *********************************** Set table with SQL Queries to Execute ***********************************************  "

 | table [|makeresults |  eval search ="CPU_HEADLINE CPU_HEADLINE_BWP CPU_DEATILS_BWP MEM_HEADLINE MEM_BWP" | table search ] 
 | transpose 
 | rename "row 1" AS RCA_SQL_TEXT 
 | table RCA_SQL_TEXT

| where isnotnull(RCA_SQL_TEXT)
| map maxsearches=20 search="dbxquery query=\"$RCA_SQL_TEXT$\" connection=\"HANA_MLBSO\" "
| mvcombine LINE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result without mvcombine, empty lines (spaces) are there before and after the CPU line:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7986i3C34A6C0FC65353F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Result with mvcombine, empty lines are skipped, but I need them for the formatting of the $result.LINE$ in my alert text ...&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7987i61A45C4F09D2ABA7/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:16:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491228#M8838</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2019-11-19T12:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491229#M8839</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults count=2
| streamstats count
| eval _time = if (count==2,relative_time(_time,"-30m@m"), relative_time(_time,"@m"))
| makecontinuous span=1m
| eval tmp="----------------------------------------------------------------------"
| streamstats count
| eval value = if(count % 2 == 1,substr(tmp,random() % 5 + 1,random() % 60 + 5) ," ")
| table value
| mvcombine value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, Changing NULL to blank seems to solve the problem&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; base search 
 | eval LINE = NULL
 | map maxsearches=20 search="dbxquery query=\"$RCA_SQL_TEXT$\" connection=\"HANA_MLBSO\" "
 | eval LINE = if(isnull(LINE), " ",LINE)
 | mvcombine LINE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How about it?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 12:44:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491229#M8839</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-19T12:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491230#M8840</link>
      <description>&lt;P&gt;@to4kawa &lt;/P&gt;

&lt;P&gt;Not sure if I understood ...&lt;BR /&gt;
I implemented:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval LINE = if(isnull(LINE), " ",LINE)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it did not help. Also in your example, the space lines that are in the initial table get skipped by mvcombine, they are not there in the output.&lt;/P&gt;

&lt;P&gt;Could you advise?   &lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 13:50:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491230#M8840</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2019-11-19T13:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491231#M8841</link>
      <description>&lt;P&gt;Changing to blank when &lt;STRONG&gt;LINE&lt;/STRONG&gt; field is &lt;EM&gt;NULL&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;If you look closely at the example query, you will see a blank line.&lt;/P&gt;

&lt;P&gt;I am correcting the previous answer.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 14:02:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491231#M8841</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-19T14:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491232#M8842</link>
      <description>&lt;P&gt;Sorry, still not getting it ...&lt;/P&gt;

&lt;P&gt;I execute your example, first without mvcombine - there I can clearly see the empty lines in between, then with mvcombine - then the empty lines are gone, or I can't see them at least.&lt;/P&gt;

&lt;P&gt;For my case - the empty lines are not NULL lines, they are series of space characters. Therefore I am not sure whether the "if" statement would replace anything. Also, I do not see any change after I implemented your suggestion&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 14:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491232#M8842</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2019-11-19T14:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491233#M8843</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;value
-----------------------------------

----------------

-----------------------------------------

---------------------------------------------------------

----------------------------------------------------

-----------------------------------------------------------

-------------------------------------------------------------

--------------------

----------------

--------------------------------------------------------

-------

--------------------------------------

--------

------------------------------

--------------------------------------------------------

-----------------------------------------
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;my sample query result,  there is the empty line.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval LINE = if(isnotnull(LINE),LINE," ")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;how about it?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 14:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491233#M8843</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-19T14:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491234#M8844</link>
      <description>&lt;P&gt;Strange, I copy pasted your output into the notepad and I cannot see the empty lines in-between.&lt;/P&gt;

&lt;P&gt;Also in my case it did not bring anything, the beginning of my output looks as follows after mvcombine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;******************************* CPU *************************************
41% avg DB CPU utilization on BWP ls5928. Avg Statement Count is 1758 per second. 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;No empty line between the headline and text. This means the mvcombine skips these lines.&lt;/P&gt;

&lt;P&gt;Also, I am not sure if the suggested code:&lt;/P&gt;

&lt;P&gt;| eval LINE = if(isnotnull(LINE),LINE," ")&lt;/P&gt;

&lt;P&gt;changes anything, because in my case the empty lines are the strings consisting of several space characters (" "), which I would expect to be interpreted as not NULL by the above. Therefore the above line does not change anything. &lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 15:14:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491234#M8844</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2019-11-19T15:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491235#M8845</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| mvcombine delim="

" LINE
| nomv LINE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;how about it?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 00:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491235#M8845</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-20T00:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491236#M8846</link>
      <description>&lt;P&gt;We need the contents of the &lt;CODE&gt;datafetch_sql_texts2.csv&lt;/CODE&gt; file.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 23:38:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491236#M8846</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-20T23:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help with mvcombine needed</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491237#M8847</link>
      <description>&lt;P&gt;Can you not just swap out &lt;CODE&gt;| mvcombine LINE&lt;/CODE&gt; for &lt;CODE&gt;| stats list(LINE) AS LINE BY some other fields maybe here&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 23:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Help-with-mvcombine-needed/m-p/491237#M8847</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-20T23:42:57Z</dc:date>
    </item>
  </channel>
</rss>

