<?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: Export results to .txt in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105593#M27382</link>
    <description>&lt;P&gt;+2 for you, works like a champ.  Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jun 2012 16:23:19 GMT</pubDate>
    <dc:creator>miwalker</dc:creator>
    <dc:date>2012-06-26T16:23:19Z</dc:date>
    <item>
      <title>Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105583#M27372</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I was wondering if it's possible to export search and table results in a txt file ? (with a script, a command, ...)&lt;/P&gt;

&lt;P&gt;I've seen that was possible to export in json, xml and csv, but not in a txt file.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2011 15:04:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105583#M27372</guid>
      <dc:creator>aymericbrun</dc:creator>
      <dc:date>2011-05-19T15:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105584#M27373</link>
      <description>&lt;P&gt;There are a few ways to do it.&lt;/P&gt;

&lt;P&gt;From the GUI, you should also see a "Raw Events" as an export option along with json, xml, and csv.&lt;/P&gt;

&lt;P&gt;From the search language, there are several ways to do it as well.  Here is one example that will export to a text file, &lt;EM&gt;$SPLUNK_HOME/var/run/splunk/results.txt&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;outputtext usexml=false | rename _xml as raw | fields raw | fields - _* | outputcsv results.txt
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2011 17:06:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105584#M27373</guid>
      <dc:creator>bwooden</dc:creator>
      <dc:date>2011-05-19T17:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105585#M27374</link>
      <description>&lt;P&gt;Works perfectly, great !&lt;/P&gt;

&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2011 07:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105585#M27374</guid>
      <dc:creator>aymericbrun</dc:creator>
      <dc:date>2011-05-20T07:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105586#M27375</link>
      <description>&lt;P&gt;I have another question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Everytime i do that command, a new "results.txt" is created, witch replace (and erase) the last "results.txt". Is it possible to write at the end of this file ?&lt;/P&gt;

&lt;P&gt;When i start this search, i'd like the results be added at the end of the file, to have a bigger and bigger file everytime i start the search.&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2011 09:45:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105586#M27375</guid>
      <dc:creator>aymericbrun</dc:creator>
      <dc:date>2011-05-20T09:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105587#M27376</link>
      <description>&lt;P&gt;outputcsv doesn't currently support an append.  So we use it as an input, add a search to it, and the write the results out again...&lt;/P&gt;

&lt;P&gt;|inputcsv results.txt | append [search * | head 10 | outputtext usexml=false | rename _xml as raw | fields raw | fields - _* ] | outputcsv results.txt&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2011 12:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105587#M27376</guid>
      <dc:creator>bwooden</dc:creator>
      <dc:date>2011-05-20T12:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105588#M27377</link>
      <description>&lt;P&gt;Thank you for your quick answer, but the second command you wrote doesn't work. In fact, it works better than your first command, but the results are not appended to the existing results.txt. Splunk keeps creating a new "results.txt" witch contains the results of the last search, results are not added in the existing file.&lt;/P&gt;

&lt;P&gt;Here's what i wrote:&lt;/P&gt;

&lt;P&gt;inputcsv results.txt | append [search source="access_combined" | outputtext usexml=false | rename _xml as raw | fields raw | fields - _* ] | outputcsv results.txt&lt;/P&gt;

&lt;P&gt;Have you an idea ?&lt;/P&gt;

&lt;P&gt;Extra : I have a second problem, the search can't finalize because "subsearch auto-finalized after time limit (30 seconds) reached". I search how to disable this but i can't find anything !&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2011 09:18:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105588#M27377</guid>
      <dc:creator>aymericbrun</dc:creator>
      <dc:date>2011-05-23T09:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105589#M27378</link>
      <description>&lt;P&gt;The above comment should have a '_' prefix before the xml and the asterik but were used to italicize the text between&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2011 13:19:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105589#M27378</guid>
      <dc:creator>bwooden</dc:creator>
      <dc:date>2011-05-23T13:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105590#M27379</link>
      <description>&lt;P&gt;You can prepend instead of append to eliminate the subsearch.  NB:  In below text, due to comment formatting, replace the two instances of ~ with a _ &lt;/P&gt;

&lt;P&gt;source="access_combined" | head 10 | outputtext usexml=false | rename ~xml as raw | fields raw | fields - ~* | append [|inputcsv results.txt ] | outputcsv results.txt&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2011 13:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105590#M27379</guid>
      <dc:creator>bwooden</dc:creator>
      <dc:date>2011-05-23T13:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105591#M27380</link>
      <description>&lt;P&gt;Thank you very much for your help! Now it works really well (thanks to your last answer)&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2011 13:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105591#M27380</guid>
      <dc:creator>aymericbrun</dc:creator>
      <dc:date>2011-05-23T13:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105592#M27381</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I found this post very helpful! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I have a small question about it. Is there a way how to store the exported file in a different folder? Eg. in /tmp/ ?&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2012 09:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105592#M27381</guid>
      <dc:creator>simonattardGO</dc:creator>
      <dc:date>2012-02-03T09:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105593#M27382</link>
      <description>&lt;P&gt;+2 for you, works like a champ.  Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2012 16:23:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105593#M27382</guid>
      <dc:creator>miwalker</dc:creator>
      <dc:date>2012-06-26T16:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105594#M27383</link>
      <description>&lt;P&gt;But even if you mention results.txt the output would result.txt.csv.  I faced the same situation. &lt;BR /&gt;
The output of the|outputcsv is always .csv ?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 20:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105594#M27383</guid>
      <dc:creator>vkakani60</dc:creator>
      <dc:date>2016-09-08T20:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105595#M27384</link>
      <description>&lt;P&gt;NO...! You can't export the &lt;CODE&gt;|outputcsv&lt;/CODE&gt; to &lt;CODE&gt;/tmp/&lt;/CODE&gt; or some other folder, according to the |outputcsv doc  &lt;/P&gt;

&lt;P&gt;the file will save &lt;CODE&gt;$SPLUNK_HOME/var/run/*.csv&lt;/CODE&gt; ,&lt;BR /&gt;
 example directory&lt;BR /&gt;
 &lt;CODE&gt;C:\Program Files\Splunk\var\run\splunk\csv&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 20:34:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105595#M27384</guid>
      <dc:creator>vkakani60</dc:creator>
      <dc:date>2016-09-08T20:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Export results to .txt</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105596#M27385</link>
      <description>&lt;P&gt;| outputcsv &lt;CODE&gt;append=true&lt;/CODE&gt; create_empty=false results&lt;/P&gt;

&lt;P&gt;here the search results will be saved in resutls.csv under &lt;CODE&gt;$SPLUNK_HOME/var/run/*.csv&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Sep 2016 20:37:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Export-results-to-txt/m-p/105596#M27385</guid>
      <dc:creator>vkakani60</dc:creator>
      <dc:date>2016-09-08T20:37:30Z</dc:date>
    </item>
  </channel>
</rss>

