<?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 to add a field to an event to verify when it has been  output to a csv. in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232536#M45353</link>
    <description>&lt;P&gt;Given this clarification:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;The scheduled search runs, and a time stamped output csv file is created (DMY-HMS.csv). Say for example that new events arrive into Splunk , and the search runs again, I only want new events sent to a new csv file, I don't want the events included that were csv'ed earlier. 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Search Here NOT [| inputcsv YourFileName.csv] | Your Stuff Here | outputcsv YourFileName.csv
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 15 Nov 2015 20:12:49 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-11-15T20:12:49Z</dc:date>
    <item>
      <title>How to add a field to an event to verify when it has been  output to a csv.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232533#M45350</link>
      <description>&lt;P&gt;Is it possible to add a  field to an event to verify when it has been output to a csv? Once I have completed a search, and outputted the results to a CSV file. This is to verify that it has been sent, and not sent again if the search is run again. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 15:11:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232533#M45350</guid>
      <dc:creator>awedmondson</dc:creator>
      <dc:date>2015-11-11T15:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a field to an event to verify when it has been  output to a csv.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232534#M45351</link>
      <description>&lt;P&gt;If I understand you correctly, you would like to have a single scheduled search that works like this:  If there already is a CSV file, then do nothing; otherwise, create the file.  If so, try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputcsv YourFileName.csv | stats count AS doesFileExistAlready | addinfo | eval earliestMaybe=if((doesFileExistAlready==0), info_min_time, now()) | map search="search earliest=$earliestMaybe$ latest=$info_max_time$ YOUR SEARCH HERE | outputcsv YourFileName.csv"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If the file already exists (and has at least 1 event/row), the search will generate an error and abort, leaving the file as-is; if it does not exist, it will get created.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 16:19:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232534#M45351</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-11T16:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a field to an event to verify when it has been  output to a csv.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232535#M45352</link>
      <description>&lt;P&gt;Hi, Thank you for your reply. I didn't explain clearly. The scheduled search runs, and a time stamped output csv file is created (DMY-HMS.csv).  Say for example that new events  arrive into Splunk , and the search runs again, I only want new events sent to a new csv file, I don't want the events included that were csv'ed earlier. &lt;/P&gt;</description>
      <pubDate>Sun, 15 Nov 2015 17:05:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232535#M45352</guid>
      <dc:creator>awedmondson</dc:creator>
      <dc:date>2015-11-15T17:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a field to an event to verify when it has been  output to a csv.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232536#M45353</link>
      <description>&lt;P&gt;Given this clarification:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;The scheduled search runs, and a time stamped output csv file is created (DMY-HMS.csv). Say for example that new events arrive into Splunk , and the search runs again, I only want new events sent to a new csv file, I don't want the events included that were csv'ed earlier. 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Search Here NOT [| inputcsv YourFileName.csv] | Your Stuff Here | outputcsv YourFileName.csv
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Nov 2015 20:12:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232536#M45353</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-15T20:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a field to an event to verify when it has been  output to a csv.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232537#M45354</link>
      <description>&lt;P&gt;Interesting idea, Thanks. Do you know if it is possible to actually  add a field to the events called "sent" with a timestamp of when the output csv was created? This would allow to only create the output csv based events that have not been sent already. &lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2015 08:59:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232537#M45354</guid>
      <dc:creator>awedmondson</dc:creator>
      <dc:date>2015-11-16T08:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a field to an event to verify when it has been  output to a csv.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232538#M45355</link>
      <description>&lt;P&gt;Sure, just add this somewhere:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval sent=now() ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Nov 2015 21:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232538#M45355</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-16T21:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a field to an event to verify when it has been  output to a csv.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232539#M45356</link>
      <description>&lt;P&gt;Thank you for your help, much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 22:29:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-a-field-to-an-event-to-verify-when-it-has-been-output/m-p/232539#M45356</guid>
      <dc:creator>awedmondson</dc:creator>
      <dc:date>2015-11-17T22:29:55Z</dc:date>
    </item>
  </channel>
</rss>

