<?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: outputcsv: How to include the current Splunk user ID and date in the CSV file name? (ex: splunkuserid_date.csv) in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/outputcsv-How-to-include-the-current-Splunk-user-ID-and-date-in/m-p/255458#M49065</link>
    <description>&lt;P&gt;I used SPL like this  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;    &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my search | outputcsv  [ | rest /services/authentication/current-context splunk_server=local | eval time=strftime(now(), "%Y_%m_%d_%H_%M_%S") | fields username time | eval csvnm = toString(username) + "_" +toString(time) | return $csvnm] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 May 2016 06:04:50 GMT</pubDate>
    <dc:creator>remnant_8</dc:creator>
    <dc:date>2016-05-19T06:04:50Z</dc:date>
    <item>
      <title>outputcsv: How to include the current Splunk user ID and date in the CSV file name? (ex: splunkuserid_date.csv)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/outputcsv-How-to-include-the-current-Splunk-user-ID-and-date-in/m-p/255457#M49064</link>
      <description>&lt;P&gt;I want output csv like this "splunkuserid_data.csv" automatically. For example:&lt;BR /&gt;
admin_17_05_16_09_07_58.csv &lt;BR /&gt;
I tried this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my search | outputcsv [| stats count | addinfo | eval filename=strftime(now(), "filename_%d_%m_%y_%H_%M_%S") | return $filename ] 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I know how to get get the current Splunk user id with &lt;CODE&gt;|rest /services/authentication/current-context splunk_server=local | fields username&lt;/CODE&gt;, but I don't know how to include the Splunk user id in the CSV file name&lt;/P&gt;

&lt;P&gt;Does anyone have an idea?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:44:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/outputcsv-How-to-include-the-current-Splunk-user-ID-and-date-in/m-p/255457#M49064</guid>
      <dc:creator>remnant_8</dc:creator>
      <dc:date>2020-09-29T09:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: outputcsv: How to include the current Splunk user ID and date in the CSV file name? (ex: splunkuserid_date.csv)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/outputcsv-How-to-include-the-current-Splunk-user-ID-and-date-in/m-p/255458#M49065</link>
      <description>&lt;P&gt;I used SPL like this  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;    &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my search | outputcsv  [ | rest /services/authentication/current-context splunk_server=local | eval time=strftime(now(), "%Y_%m_%d_%H_%M_%S") | fields username time | eval csvnm = toString(username) + "_" +toString(time) | return $csvnm] 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2016 06:04:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/outputcsv-How-to-include-the-current-Splunk-user-ID-and-date-in/m-p/255458#M49065</guid>
      <dc:creator>remnant_8</dc:creator>
      <dc:date>2016-05-19T06:04:50Z</dc:date>
    </item>
  </channel>
</rss>

