<?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: How do I pipe splunk query output to a file? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10329#M448</link>
    <description>&lt;P&gt;For Splunk 6.4.x:&lt;BR /&gt;
Here is a list of different option for exporting to a file from the CLI&lt;/P&gt;

&lt;PRE&gt;
$SPLUNK_HOME/bin/splunk search 'index=main' -output table &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search 'index=main | head' -output raw &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search 'index=main | head' -output rawdata &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search '*' -output csv &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search 'index=main id=abs*' -output json &amp;gt; tofile.txt
&lt;/PRE&gt;

&lt;P&gt;The default behavior of the CLI search is to export first 100. Use the &lt;CODE&gt;-maxout 0&lt;/CODE&gt; option to bypass that limit.&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
$SPLUNK_HOME/bin/splunk search 'index=main id=abs*' -output json -maxout 0 &amp;gt; tofile.txt&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;If you don't specify an output option, the default is to only export  &lt;CODE&gt;_raw&lt;/CODE&gt;. &lt;/P&gt;</description>
    <pubDate>Thu, 22 Sep 2016 04:04:07 GMT</pubDate>
    <dc:creator>mIliofotou_splu</dc:creator>
    <dc:date>2016-09-22T04:04:07Z</dc:date>
    <item>
      <title>How do I pipe splunk query output to a file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10325#M444</link>
      <description>&lt;P&gt;How do I take output (say . . . "View Sources") and pipe it to a file?&lt;/P&gt;</description>
      <pubDate>Sat, 20 Mar 2010 01:25:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10325#M444</guid>
      <dc:creator>Alan_Bradley</dc:creator>
      <dc:date>2010-03-20T01:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I pipe splunk query output to a file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10326#M445</link>
      <description>&lt;P&gt;You have couple of options. The basic is simply using redirect to file, you can also use the -format flag. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;./splunk search '*' -format csv &amp;gt; file-name&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;Valid types are: custom, normal, xml, csv, table You can also use one of the output search commands:&lt;BR /&gt; &lt;A href="http://www.splunk.com/base/Documentation/3.4.9/User/UnsupportedSearchCommands#outputcsv" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/3.4.9/User/UnsupportedSearchCommands#outputcsv&lt;/A&gt; &lt;BR /&gt; &lt;A href="http://www.splunk.com/base/Documentation/3.4.9/User/UnsupportedSearchCommands#outputraw" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/3.4.9/User/UnsupportedSearchCommands#outputraw&lt;/A&gt; 
&lt;BR /&gt;and the other outputtxt outputxml &lt;/P&gt;

&lt;P&gt;Or the export option from the GUI or CLI: &lt;A href="http://www.splunk.com/base/Documentation/3.4.9/Admin/ExportEventData" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/3.4.9/Admin/ExportEventData&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Mar 2010 01:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10326#M445</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2010-03-20T01:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I pipe splunk query output to a file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10327#M446</link>
      <description>&lt;P&gt;Doesn't work. &lt;CODE&gt;WARN: The following arguments were unknown or had no effect: 'format'&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2014 15:10:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10327#M446</guid>
      <dc:creator>jameshfisher</dc:creator>
      <dc:date>2014-07-25T15:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I pipe splunk query output to a file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10328#M447</link>
      <description>&lt;P&gt;Here is the updated syntax and related doco link: &lt;BR /&gt;
/splunk search "index=_* audit" -output 'csv' &amp;gt; /var/share/splunk_output/20140724-audit.csv&lt;/P&gt;

&lt;P&gt;doco link: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.2/SearchReference/CLIsearchsyntax" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.2/SearchReference/CLIsearchsyntax&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:11:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10328#M447</guid>
      <dc:creator>barakreeves</dc:creator>
      <dc:date>2020-09-28T17:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I pipe splunk query output to a file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10329#M448</link>
      <description>&lt;P&gt;For Splunk 6.4.x:&lt;BR /&gt;
Here is a list of different option for exporting to a file from the CLI&lt;/P&gt;

&lt;PRE&gt;
$SPLUNK_HOME/bin/splunk search 'index=main' -output table &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search 'index=main | head' -output raw &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search 'index=main | head' -output rawdata &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search '*' -output csv &amp;gt; tofile.txt
$SPLUNK_HOME/bin/splunk search 'index=main id=abs*' -output json &amp;gt; tofile.txt
&lt;/PRE&gt;

&lt;P&gt;The default behavior of the CLI search is to export first 100. Use the &lt;CODE&gt;-maxout 0&lt;/CODE&gt; option to bypass that limit.&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
$SPLUNK_HOME/bin/splunk search 'index=main id=abs*' -output json -maxout 0 &amp;gt; tofile.txt&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;If you don't specify an output option, the default is to only export  &lt;CODE&gt;_raw&lt;/CODE&gt;. &lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 04:04:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-pipe-splunk-query-output-to-a-file/m-p/10329#M448</guid>
      <dc:creator>mIliofotou_splu</dc:creator>
      <dc:date>2016-09-22T04:04:07Z</dc:date>
    </item>
  </channel>
</rss>

