<?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 Move _time to the last column in the attached mail in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Move-time-to-the-last-column-in-the-attached-mail/m-p/464710#M130951</link>
    <description>&lt;P&gt;How I can move _time column to be the last on the an attached  csv file in the email send by scheduled report&lt;BR /&gt;&lt;BR /&gt;
the query returns the _time as the last column but in the attached mail it's set as a fist column &lt;/P&gt;

&lt;P&gt;the query&lt;BR /&gt;&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
| table USER_ID duser FIRST_NAME LAST_NAME Duration cn1 _time &lt;BR /&gt;
| rename cn1 as "Duration (sec)", FIRST_NAME as "First Name", LAST_NAME as "Last Name" &lt;BR /&gt;
| search "First Name"="&lt;EM&gt;" AND "Last Name"="&lt;/EM&gt;"&lt;BR /&gt;
| outputcsv vpn_data.csv&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:50:31 GMT</pubDate>
    <dc:creator>rayar</dc:creator>
    <dc:date>2020-09-30T04:50:31Z</dc:date>
    <item>
      <title>Move _time to the last column in the attached mail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Move-time-to-the-last-column-in-the-attached-mail/m-p/464710#M130951</link>
      <description>&lt;P&gt;How I can move _time column to be the last on the an attached  csv file in the email send by scheduled report&lt;BR /&gt;&lt;BR /&gt;
the query returns the _time as the last column but in the attached mail it's set as a fist column &lt;/P&gt;

&lt;P&gt;the query&lt;BR /&gt;&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
| table USER_ID duser FIRST_NAME LAST_NAME Duration cn1 _time &lt;BR /&gt;
| rename cn1 as "Duration (sec)", FIRST_NAME as "First Name", LAST_NAME as "Last Name" &lt;BR /&gt;
| search "First Name"="&lt;EM&gt;" AND "Last Name"="&lt;/EM&gt;"&lt;BR /&gt;
| outputcsv vpn_data.csv&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Move-time-to-the-last-column-in-the-attached-mail/m-p/464710#M130951</guid>
      <dc:creator>rayar</dc:creator>
      <dc:date>2020-09-30T04:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Move _time to the last column in the attached mail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Move-time-to-the-last-column-in-the-attached-mail/m-p/464711#M130952</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/45236"&gt;@rayar&lt;/a&gt; as per the doc for output command, it adds the _time field to the front. &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Outputcsv#Internal_fields_and_the_outputcsv_command" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/Outputcsv#Internal_fields_and_the_outputcsv_command&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;if you want to have the strict order, here is a workaround:&lt;/P&gt;

&lt;P&gt;| rename cn1 as "Duration (sec)", FIRST_NAME as "First Name", LAST_NAME as "Last Name"&lt;BR /&gt;
| search "First Name"="" AND "Last Name"=""&lt;BR /&gt;
| eval time = strftime(_time, "%Y-%d-%m %H:%M:%S")&lt;BR /&gt;
| fields USER_ID duser "First Name" "Last Name" Duration "Duration (sec)" time&lt;BR /&gt;
| outputcsv vpn_data.csv&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Move-time-to-the-last-column-in-the-attached-mail/m-p/464711#M130952</guid>
      <dc:creator>anmolpatel</dc:creator>
      <dc:date>2020-09-30T04:51:03Z</dc:date>
    </item>
  </channel>
</rss>

