<?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: Splunk should upgrade the `noop` command to take a single string parameter (making it a `comment` command) and then document it! in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138243#M184779</link>
    <description>&lt;P&gt;I agree with the usefulness of a &lt;CODE&gt;comment&lt;/CODE&gt; command.  As a workaround, I use &lt;CODE&gt;eval comment="What I'm trying to do here"&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jun 2015 12:11:06 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2015-06-08T12:11:06Z</dc:date>
    <item>
      <title>Splunk should upgrade the `noop` command to take a single string parameter (making it a `comment` command) and then document it!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138242#M184778</link>
      <description>&lt;P&gt;I just discovered the interesting &lt;CODE&gt;noop&lt;/CODE&gt; command and have been playing around with it.  I cannot find it mentioned &lt;EM&gt;ANYWHERE&lt;/EM&gt;!  I was hoping that it would take a single &lt;CODE&gt;string&lt;/CODE&gt; parameter so that it would act as a &lt;CODE&gt;comment&lt;/CODE&gt; command like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | noop "My comment here - Jesus is the only way to be reconciled to God: repent of all sin and trust Him as your Savior, then read your Bible every day and do what the Holy Spirit convicts you to do!" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This &lt;CODE&gt;comment&lt;/CODE&gt; functionality should be implemented; it would be very useful to &lt;EM&gt;many&lt;/EM&gt; people and is long overdue.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2015 06:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138242#M184778</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-08T06:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk should upgrade the `noop` command to take a single string parameter (making it a `comment` command) and then document it!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138243#M184779</link>
      <description>&lt;P&gt;I agree with the usefulness of a &lt;CODE&gt;comment&lt;/CODE&gt; command.  As a workaround, I use &lt;CODE&gt;eval comment="What I'm trying to do here"&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2015 12:11:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138243#M184779</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-08T12:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk should upgrade the `noop` command to take a single string parameter (making it a `comment` command) and then document it!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138244#M184780</link>
      <description>&lt;P&gt;&lt;CODE&gt;noop&lt;/CODE&gt; is indeed a fun one. I originally found it myself digging through how certain distributed queries were working &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/Knowledge/ViewsearchjobpropertieswiththeJobInspector"&gt;with the job inspector&lt;/A&gt;. I've seen people use the actually documented &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Localop"&gt;localop&lt;/A&gt; for similar purposes of mocking out search data as well.&lt;/P&gt;

&lt;P&gt;I agree that comment is a feature missing from the SPL, it'd be nice to be able to paste long search strings here and be able to have inline comments explaining certain pieces, while still letting others copy and paste the search as a whole including comments into their splunk instances to try things out. &lt;/P&gt;

&lt;P&gt;That said there are a number of interesting workarounds found &lt;A href="http://answers.splunk.com/answers/48865/add-a-comment-to-a-search.html"&gt;on this older answer thread&lt;/A&gt; and @ewoo's answer adding a macro that wraps the noop command and throws away the argument may be just what you're looking for. (That way we preserve the semantics of this No Operation, and with the name of the macro we clearly indicate to the user what's happening)&lt;/P&gt;

&lt;P&gt;As pointed out on the other thread, he downside to using eval as suggested by @richgalloway is that you wind up adding a field to every event in your result set (or intermediate result set) which could be a lot of processing depending on how many events you have at the time. &lt;/P&gt;

&lt;P&gt;While the macro solution as it stands is interesting, I also have to wonder if there's a possibility of a eval-based macro, or macro that returns nothing, so that inline comments become possible without changing impact of them within commands as well.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rename *_bear as *_wolf `comment("the input fields are off and we need to correlate them")` moose as squirrel `comment("Ok this is just a bad joke")`
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jun 2015 16:37:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138244#M184780</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-06-08T16:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk should upgrade the `noop` command to take a single string parameter (making it a `comment` command) and then document it!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138245#M184781</link>
      <description>&lt;P&gt;Splunk Case 245041 &lt;CODE&gt;Splunk "noop" command totally undocumented&lt;/CODE&gt; has been filed as bug &lt;CODE&gt;SPL-102993&lt;/CODE&gt; to add &lt;CODE&gt;noop&lt;/CODE&gt; to the list of search commands here:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/ListOfSearchCommands"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/ListOfSearchCommands&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 21:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138245#M184781</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-10T21:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk should upgrade the `noop` command to take a single string parameter (making it a `comment` command) and then document it!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138246#M184782</link>
      <description>&lt;P&gt;The noop command is an internal command used by Splunk for debugging.&lt;/P&gt;

&lt;P&gt;If you want to add comments to your search strings, anywhere in the search string, use the method mentioned by steveyz in this Answer&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/48865/add-a-comment-to-a-search.html"&gt;https://answers.splunk.com/answers/48865/add-a-comment-to-a-search.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It is also now documented in the Search Manual:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/Search/Addcommentstosearches"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/Search/Addcommentstosearches&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 19:34:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-should-upgrade-the-noop-command-to-take-a-single-string/m-p/138246#M184782</guid>
      <dc:creator>lstewart_splunk</dc:creator>
      <dc:date>2015-10-13T19:34:33Z</dc:date>
    </item>
  </channel>
</rss>

