<?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 Running outputcsv without append option in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Running-outputcsv-without-append-option/m-p/106112#M2432</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;We are running an outputcsv command in hourly intervals through a python script. We have not mentioned append option in the query. I would like to know what should be the expected behavior of Splunk. Will the csv file be overwritten every hour? Will the headers alone be retained? Please clarify.&lt;/P&gt;

&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2013 11:59:03 GMT</pubDate>
    <dc:creator>keerthana_k</dc:creator>
    <dc:date>2013-04-25T11:59:03Z</dc:date>
    <item>
      <title>Running outputcsv without append option</title>
      <link>https://community.splunk.com/t5/Reporting/Running-outputcsv-without-append-option/m-p/106112#M2432</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;We are running an outputcsv command in hourly intervals through a python script. We have not mentioned append option in the query. I would like to know what should be the expected behavior of Splunk. Will the csv file be overwritten every hour? Will the headers alone be retained? Please clarify.&lt;/P&gt;

&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2013 11:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Running-outputcsv-without-append-option/m-p/106112#M2432</guid>
      <dc:creator>keerthana_k</dc:creator>
      <dc:date>2013-04-25T11:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Running outputcsv without append option</title>
      <link>https://community.splunk.com/t5/Reporting/Running-outputcsv-without-append-option/m-p/106113#M2433</link>
      <description>&lt;P&gt;The given csv will be overwritten every time outputcsv runs,  headers and all.  the new headers will simply match the fields in the new results. &lt;/P&gt;

&lt;P&gt;It is the same for the outputlookup command. &lt;/P&gt;

&lt;P&gt;Also, in a lot of real-world use cases, using the append flag on the outputcsv command itself can result in a lot of duplicates.    As a result it can be better to do the appending separately, along with a little  search language to remove the duplicates as appropriate. &lt;/P&gt;

&lt;P&gt;Here is a simple example, where the csv has a primary key called 'user', and the csv is just mapping each user to a "group" field. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search terms to get the "new" rows mapping users to groups&amp;gt; | stats last(group) as group by user | append [| inputcsv mycsv] | stats first(group) as group by user | outputcsv mycsv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, each time the search runs it will update the corresponding users that have changed, but not duplicate them.   Obviously it's a very simple example with only two fields, but with a little more attention to the stats commands you can use the same technique.  Note that it's better to put the inputcsv command in the append; if you put the actual search in the append you may increase the chances of hitting limits in append concerning execution time or number of rows. &lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2013 18:53:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Running-outputcsv-without-append-option/m-p/106113#M2433</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-04-25T18:53:26Z</dc:date>
    </item>
  </channel>
</rss>

