<?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: Why is outputlookup not updating the csv file as intended? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-outputlookup-not-updating-the-csv-file-as-intended/m-p/312481#M93555</link>
    <description>&lt;P&gt;I tried what you suggested SPL, and it returned the same result.&lt;BR /&gt;
But i tried your first recommendation by removing append=true to everything and it worked! &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup test.csv 
| eval n = strftime((strptime(date_last, "%Y-%m-%dT%H:%M:%S.000Z")), "%m/%d/%Y %H:%M:%S") 
| fields date_first date_last n
| outputlookup e test.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 06 Apr 2018 03:25:58 GMT</pubDate>
    <dc:creator>esmonder</dc:creator>
    <dc:date>2018-04-06T03:25:58Z</dc:date>
    <item>
      <title>Why is outputlookup not updating the csv file as intended?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-outputlookup-not-updating-the-csv-file-as-intended/m-p/312479#M93553</link>
      <description>&lt;P&gt;I have a lookup file in the form of test.csv&lt;BR /&gt;
in the test.csv there are two columns with date fields(date_first and date_last), of which i want to convert date_last to a splunk recognizable date field and appendcols to the test.csv&lt;/P&gt;

&lt;P&gt;my code: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup append=true test.csv 
| appendcols 
    [| inputlookup test.csv 
    | eval n = strftime((strptime(date_last, "%Y-%m-%dT%H:%M:%S.000Z")), "%m/%d/%Y %H:%M:%S") 
    | eval _time = n ] 
| outputlookup append=true test.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;results are as follows in the statistics view of the same search page:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;date_first                date_last                   n
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
2017-06-02T15:13:11.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
2017-06-02T15:13:11.000Z    2017-06-02T15:14:42.000Z    06/02/2017 15:14:42
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The intent is to save the above results in test.csv (correct my SPL if i'm wrong and somehow i can't save the column as _time) &lt;BR /&gt;
but when i do a subsequent |inputlookup test.csv, this is my results(rows just doubled with the initial data):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;date_first                date_last
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:11.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:11.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:10.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:11.000Z    2017-06-02T15:14:42.000Z
2017-06-02T15:13:11.000Z    2017-06-02T15:14:42.000Z
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So just wondering what is going on here? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:51:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-outputlookup-not-updating-the-csv-file-as-intended/m-p/312479#M93553</guid>
      <dc:creator>esmonder</dc:creator>
      <dc:date>2020-09-29T18:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why is outputlookup not updating the csv file as intended?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-outputlookup-not-updating-the-csv-file-as-intended/m-p/312480#M93554</link>
      <description>&lt;P&gt;The rows are doubled in the lookup file because of &lt;CODE&gt;append=true&lt;/CODE&gt;.  If you remove that option, the existing lookup file will be replaced and the third column should be added.&lt;BR /&gt;
You say you want a "splunk recognizable date field", but the existing date fields are already readily recognizable by Splunk.  What is the purpose of this excercise?&lt;BR /&gt;
The &lt;CODE&gt;appendcols&lt;/CODE&gt; command seems unnecessary.  Have you tried &lt;CODE&gt;| inputlookup append=true test.csv &lt;BR /&gt;
| eval n = strftime((strptime(date_last, "%Y-%m-%dT%H:%M:%S.000Z")), "%m/%d/%Y %H:%M:%S") &lt;BR /&gt;
| fields date_first date_last n&lt;BR /&gt;
| outputlookup append=true test.csv&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-outputlookup-not-updating-the-csv-file-as-intended/m-p/312480#M93554</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-04-04T12:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why is outputlookup not updating the csv file as intended?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-outputlookup-not-updating-the-csv-file-as-intended/m-p/312481#M93555</link>
      <description>&lt;P&gt;I tried what you suggested SPL, and it returned the same result.&lt;BR /&gt;
But i tried your first recommendation by removing append=true to everything and it worked! &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup test.csv 
| eval n = strftime((strptime(date_last, "%Y-%m-%dT%H:%M:%S.000Z")), "%m/%d/%Y %H:%M:%S") 
| fields date_first date_last n
| outputlookup e test.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 03:25:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-outputlookup-not-updating-the-csv-file-as-intended/m-p/312481#M93555</guid>
      <dc:creator>esmonder</dc:creator>
      <dc:date>2018-04-06T03:25:58Z</dc:date>
    </item>
  </channel>
</rss>

