<?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: Code Sample does not work well. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488284#M193944</link>
    <description>&lt;P&gt;thanks @woodcock&lt;BR /&gt;
I asked in &lt;A href="https://docs.splunk.com/Documentation/Splunkbase/splunkbase/Answers/Questions"&gt;Splunk&amp;gt;docs&lt;/A&gt;.&lt;BR /&gt;
This question is created to explain to Splunk.&lt;BR /&gt;
At present, the CSS of tag &lt;CODE&gt;&amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt;&lt;/CODE&gt; and &lt;EM&gt;Code Sample&lt;/EM&gt;  is list notation.&lt;BR /&gt;
so, extra space is added, I think.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Community/1.0/community/SplunkIdeas"&gt;Splunk Ideas&lt;/A&gt;&lt;BR /&gt;
&lt;CODE&gt;In the Splunk Ideas portal, you can search for, vote on, and request new enhancements (called an idea) for any of the Splunk solutions. Splunk Ideas replaces the need to log a P4 enhancement request ticket with Splunk Support.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I don't think this question is &lt;EM&gt;new enhancements&lt;/EM&gt; . This is just the issue.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Mar 2020 21:46:01 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-03-06T21:46:01Z</dc:date>
    <item>
      <title>Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488278#M193938</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="Source1_field2,Count
dev,6
prod,5
uat,7
qa,8"
| multikv forceheader=1
| table Source1_field2,Count
| rename COMMENT as "this is sample your stats output"
| transpose 0 header_field=Source1_field2
| eval "prod + uat"=prod+uat
| fields - prod uat
| transpose 0 column_name="Source1_field2" header_field=column
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this code works. but &lt;CODE&gt;code sample&lt;/CODE&gt; add extra space.&lt;BR /&gt;
copy and paste to &lt;EM&gt;search&lt;/EM&gt; , this is not works.&lt;BR /&gt;
What should I do?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Source1_field2  Count
    dev 6
    qa  8
    prod + uat  12
This is correct result.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 11:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488278#M193938</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-06T11:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488279#M193939</link>
      <description>&lt;P&gt;I copied and pasted your sample, which has a leading space on every line, and it works in my Splunk. I did notice that the first line says &lt;CODE&gt;| makeresults&lt;/CODE&gt; (with a leading space) but when I hit the search button, Splunk auto-removed just that line's leading space, left the others with a leading space, and ran fine.&lt;/P&gt;

&lt;P&gt;My browser is Vivaldi   2.10.1745.27 (Stable channel) (64-bit) and Splunk Enterprise is 7.2.8.&lt;/P&gt;

&lt;P&gt;Output:&lt;BR /&gt;
    Source1_field2  Count&lt;BR /&gt;
     dev    6&lt;BR /&gt;
     prod   5&lt;BR /&gt;
     uat    7&lt;BR /&gt;
     qa 8&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 12:49:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488279#M193939</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-03-06T12:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488280#M193940</link>
      <description>&lt;P&gt;@to4kawa &lt;CODE&gt;Code sample&lt;/CODE&gt; is a readability feature here and in other places. Anytime I copy code from anywhere, I paste it into Splunk, then press &lt;STRONG&gt;control+shift+f&lt;/STRONG&gt;, which is a Splunk shortcut for pretty formatting. This addresses readability and to your issue, removes the extra spaces. It allows me to read through the code before I submit it to my Splunk. I think this practice will address your issue.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 13:16:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488280#M193940</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2020-03-06T13:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488281#M193941</link>
      <description>&lt;P&gt;thanks for reply @jpolvino&lt;BR /&gt;
my question is updated.&lt;BR /&gt;
please confirm.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 14:12:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488281#M193941</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-06T14:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488282#M193942</link>
      <description>&lt;P&gt;HI, @efavreau&lt;BR /&gt;
my question is updated.&lt;BR /&gt;
If your results is correct, please tell me your browser.&lt;BR /&gt;
I use ⌘+⇧ +F ,too.  &lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 14:15:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488282#M193942</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-06T14:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488283#M193943</link>
      <description>&lt;P&gt;I agree that this is annoying.  I wish that there was a a way to either:&lt;BR /&gt;
Display &lt;CODE&gt;code sample&lt;/CODE&gt; in such a way that when copying from browser, the leading spaces are not there OR&lt;BR /&gt;
Have a &lt;CODE&gt;copy code sample&lt;/CODE&gt; button/option in answers so that it removes the spaces required to for &lt;CODE&gt;markdown&lt;/CODE&gt; to do &lt;CODE&gt;code sample&lt;/CODE&gt;.&lt;BR /&gt;
You should create such a request here:&lt;BR /&gt;
&lt;A href="https://ideas.splunk.com"&gt;https://ideas.splunk.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 19:21:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488283#M193943</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-06T19:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488284#M193944</link>
      <description>&lt;P&gt;thanks @woodcock&lt;BR /&gt;
I asked in &lt;A href="https://docs.splunk.com/Documentation/Splunkbase/splunkbase/Answers/Questions"&gt;Splunk&amp;gt;docs&lt;/A&gt;.&lt;BR /&gt;
This question is created to explain to Splunk.&lt;BR /&gt;
At present, the CSS of tag &lt;CODE&gt;&amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt;&lt;/CODE&gt; and &lt;EM&gt;Code Sample&lt;/EM&gt;  is list notation.&lt;BR /&gt;
so, extra space is added, I think.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Community/1.0/community/SplunkIdeas"&gt;Splunk Ideas&lt;/A&gt;&lt;BR /&gt;
&lt;CODE&gt;In the Splunk Ideas portal, you can search for, vote on, and request new enhancements (called an idea) for any of the Splunk solutions. Splunk Ideas replaces the need to log a P4 enhancement request ticket with Splunk Support.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I don't think this question is &lt;EM&gt;new enhancements&lt;/EM&gt; . This is just the issue.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 21:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488284#M193944</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-06T21:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488285#M193945</link>
      <description>&lt;P&gt;That does the same (wrong) thing.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 22:41:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488285#M193945</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-06T22:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488286#M193946</link>
      <description>&lt;P&gt;I'm not able to get your code to result in your answer through manipulating format. When you say it works that way, I have no way of continuing to help.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 23:30:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488286#M193946</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2020-03-06T23:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488287#M193947</link>
      <description>&lt;P&gt;workaround:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt; not use &lt;EM&gt;code sample&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt; use &lt;CODE&gt;rex mode=sed&lt;/CODE&gt; before &lt;CODE&gt;multikv&lt;/CODE&gt; and trim leading spaces.
 e.g. &lt;CODE&gt;| rex mode=sed "s/(?m)^\s//g"&lt;/CODE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Till the issue is fixed, I recommend No.2 solution.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 23:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488287#M193947</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-06T23:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488288#M193948</link>
      <description>&lt;P&gt;sample:(use &lt;CODE&gt;&amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt;&lt;/CODE&gt; )&lt;/P&gt;

&lt;PRE&gt;
 | makeresults
 | eval _raw="Source1_field2,Count
 dev,6
 prod,5
 uat,7
 qa,8"
 | multikv forceheader=1
 | table Source1_field2,Count
 | rename COMMENT as "this is sample your stats output"
 | transpose 0 header_field=Source1_field2
 | eval "prod + uat"=prod+uat
 | fields - prod uat
 | transpose 0 column_name="Source1_field2" header_field=column
&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 23:53:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488288#M193948</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-06T23:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488289#M193949</link>
      <description>&lt;P&gt;sample:( &lt;CODE&gt;&amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt;&lt;/CODE&gt;  in comment )&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="Source1_field2,Count
dev,6
prod,5
uat,7
qa,8"
| multikv forceheader=1
| table Source1_field2,Count
| rename COMMENT as "this is sample your stats output"
| transpose 0 header_field=Source1_field2
| eval "prod + uat"=prod+uat
| fields - prod uat
| transpose 0 column_name="Source1_field2" header_field=column
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 23:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488289#M193949</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-06T23:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488290#M193950</link>
      <description>&lt;P&gt;Same thing.  It forces a leading space between the line number and the code so that when selected/cut/pasted, it doesn't work right.  And no, CTRL-whatever does not fix it because the reformatting ignores spaces inside if double-quotes (as it should).&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 23:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488290#M193950</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-06T23:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488291#M193951</link>
      <description>&lt;P&gt;@to4kawa @woodcock this is not a behavior of Splunk, this is a behavior or &lt;CODE&gt;html table&lt;/CODE&gt; so I dont think issue fix would be there in Splunk.&lt;/P&gt;

&lt;P&gt;Refer to this bare-minimal pure html table which still adds whitespace after each cell values. Save as &lt;CODE&gt;&amp;lt;yourHTMLFileName&amp;gt;.html&lt;/CODE&gt; and open in any browser. When you perform select all you will notice extra space against each values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
   &amp;lt;body&amp;gt;
      &amp;lt;table&amp;gt;
         &amp;lt;thead&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;th&amp;gt;&amp;lt;a href="#"&amp;gt;sourcetype&amp;lt;/a&amp;gt;&amp;lt;/th&amp;gt;
               &amp;lt;th&amp;gt;&amp;lt;a href="#"&amp;gt;count&amp;lt;/a&amp;gt;&amp;lt;/th&amp;gt;
            &amp;lt;/tr&amp;gt;
         &amp;lt;/thead&amp;gt;
         &amp;lt;tbody&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;mongod&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;130&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;scheduler&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunk_archiver-too_small&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;16&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunk_web_access&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;35&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunk_web_service&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;236&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunkd&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;266434&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunkd_access&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;778&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunkd_conf&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunkd_stderr&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;1&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
            &amp;lt;tr&amp;gt;
               &amp;lt;td&amp;gt;splunkd_ui_access&amp;lt;/td&amp;gt;
               &amp;lt;td&amp;gt;833&amp;lt;/td&amp;gt;
            &amp;lt;/tr&amp;gt;
         &amp;lt;/tbody&amp;gt;
      &amp;lt;/table&amp;gt;
   &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Mar 2020 13:33:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488291#M193951</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-03-07T13:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488292#M193952</link>
      <description>&lt;P&gt;Well that stinks.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 13:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488292#M193952</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-07T13:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Code Sample does not work well.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488293#M193953</link>
      <description>&lt;P&gt;hi @niketnilay&lt;BR /&gt;
&lt;EM&gt;pure&lt;/EM&gt; &lt;CODE&gt;&amp;lt;pre&amp;gt;&amp;lt;/pre&amp;gt;&lt;/CODE&gt; does not contain leading space.&lt;BR /&gt;
&lt;EM&gt;pure&lt;/EM&gt;  &lt;CODE&gt;&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;/CODE&gt; does not contain leading space, also.&lt;BR /&gt;
I guess this problem is caused by custom css.&lt;/P&gt;

&lt;P&gt;I reported this to support and heard that they would confirm it.&lt;BR /&gt;
I thank them for their support. I hope to be fixed.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 20:17:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Code-Sample-does-not-work-well/m-p/488293#M193953</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-07T20:17:29Z</dc:date>
    </item>
  </channel>
</rss>

