<?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: When do you put a | (pipe) as the first character in a search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79542#M20135</link>
    <description>&lt;P&gt;"inputcsv" is another command where you could begin the command with a pipe.,"inputcsv" is another command where you would begin the command with a pipe.&lt;/P&gt;</description>
    <pubDate>Sun, 04 Mar 2018 23:05:26 GMT</pubDate>
    <dc:creator>erhoward</dc:creator>
    <dc:date>2018-03-04T23:05:26Z</dc:date>
    <item>
      <title>When do you put a | (pipe) as the first character in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79540#M20133</link>
      <description>&lt;P&gt;I have noticed several search commands which are preceded by a pipe character with no input left of the pipe. For example:&lt;BR /&gt;
    |eventcount index=*&lt;/P&gt;

&lt;P&gt;I looked at what would happen without the pipe and the results were all lines in the searched indexes with the word eventcount. How do you determine whether you must precede a search function with a pipe? Would you also explain what splunk is doing when it sees a pipe without input?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2012 13:04:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79540#M20133</guid>
      <dc:creator>coleman07</dc:creator>
      <dc:date>2012-06-20T13:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: When do you put a | (pipe) as the first character in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79541#M20134</link>
      <description>&lt;P&gt;Splunk expects the first tokens to be search terms or operators. BUT if the first token is the pipe |, Splunk knows that what follows is NOT a search command, and that it should not search the index(es) for the data.&lt;/P&gt;

&lt;P&gt;Beginning a "search" with a pipe is only valid for a few commands (the ones that don't need to retrieve indexed data). Here are a few, I am sure there are others&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;inputlookup &lt;/LI&gt;
&lt;LI&gt;eventcount&lt;/LI&gt;
&lt;LI&gt;metadata&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 20 Jun 2012 20:05:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79541#M20134</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-06-20T20:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: When do you put a | (pipe) as the first character in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79542#M20135</link>
      <description>&lt;P&gt;"inputcsv" is another command where you could begin the command with a pipe.,"inputcsv" is another command where you would begin the command with a pipe.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Mar 2018 23:05:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79542#M20135</guid>
      <dc:creator>erhoward</dc:creator>
      <dc:date>2018-03-04T23:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: When do you put a | (pipe) as the first character in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79543#M20136</link>
      <description>&lt;P&gt;Also "stats" can be a | command. Ex. "| stats count" will result in 0.&lt;/P&gt;

&lt;P&gt;Very useful if you want a base matrix to run a next one search starting from a base "fake search" with needed existing fields.&lt;/P&gt;

&lt;P&gt;Try&lt;/P&gt;

&lt;P&gt;" | stats count | eval l="a,b,c" | makemv delim="," l | mvexpand l "&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 22:24:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79543#M20136</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2019-01-17T22:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: When do you put a | (pipe) as the first character in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79544#M20137</link>
      <description>&lt;P&gt;The command this question is looking for is called &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commandsbytype#Generating_commands"&gt;Generating Command&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;While &lt;CODE&gt;|stats count&lt;/CODE&gt; mimics a &lt;CODE&gt;generating (report) command&lt;/CODE&gt; scenario as in presence of no events it gives count as &lt;CODE&gt;0&lt;/CODE&gt; instead of &lt;CODE&gt;no results found&lt;/CODE&gt;, it is actually a ** &lt;CODE&gt;transforming command&lt;/CODE&gt; ** which is used to &lt;CODE&gt;generate report (aggregate data)&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;makeresults&lt;/CODE&gt; or &lt;CODE&gt;gentimes&lt;/CODE&gt; generating commands can be used instead! Several examples exist for this on Splunk Answers and in Splunk Documentation.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| fields - _time
| eval data="a,b,c" 
| makemv delim="," data
| mvexpand data
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jan 2019 02:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79544#M20137</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-18T02:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: When do you put a | (pipe) as the first character in a search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79545#M20138</link>
      <description>&lt;P&gt;Ok, this is "etically" perfect right, but i really need a field count = 0 for ALL next fields, this is the base from where i was starting to generate a next report from a previous Generating Report.&lt;/P&gt;

&lt;P&gt;OK, the "concept" is different (Generating Commands or Trasforming Commands), but what i did with "stats" gave me what i need without reported errors.&lt;/P&gt;

&lt;P&gt;With the  " | stats count | eval l="a,b,c" | makemv delim="," l | mvexpand l " will give it without errors e no effort for system,&lt;BR /&gt;
with the " | makeresults | fields - _time | eval count = 0 | eval data="a,b,c" | makemv delim="," data | mvexpand data ", i need one more added field ("eval count = 0"), and delete another one "fields - _time".&lt;/P&gt;

&lt;P&gt;In my opinion, "|stats" is working fine and i keep on using it.&lt;/P&gt;

&lt;P&gt;Thanks, anyway.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jan 2019 11:02:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/When-do-you-put-a-pipe-as-the-first-character-in-a-search/m-p/79545#M20138</guid>
      <dc:creator>verbal_666</dc:creator>
      <dc:date>2019-01-19T11:02:32Z</dc:date>
    </item>
  </channel>
</rss>

