<?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: Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152611#M42758</link>
    <description>&lt;P&gt;Thanks. My original question was for an adhoc query with a 1-click solution , but these pointers towards a programmatic approach for a saved search is good too. Marking as accepted.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Apr 2015 07:56:36 GMT</pubDate>
    <dc:creator>jaalex101</dc:creator>
    <dc:date>2015-04-21T07:56:36Z</dc:date>
    <item>
      <title>Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152606#M42753</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is there a way to save the Splunk search along with the time frame of the search when exporting the results to CSV? Currently, I manually add these details to the downloaded CSV file, but there are times when I miss this and wonder what the exact search was. &lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Joseph&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 05:44:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152606#M42753</guid>
      <dc:creator>jaalex101</dc:creator>
      <dc:date>2015-04-21T05:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152607#M42754</link>
      <description>&lt;P&gt;After you export to csv, click the print button and save to PDF. The output of the "print" includes the query and the output (as much as fits on the page, so you can remember the context.Looks like this:&lt;BR /&gt;
 &lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/323i113DE13B95288789/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 05:55:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152607#M42754</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-04-21T05:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152608#M42755</link>
      <description>&lt;P&gt;Thanks, but then i have to maintain two documents. Would it be an useful feature to add this in the CSV export itself ? . The slight downside would be it would have some extra text apart from the raw data itself.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 06:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152608#M42755</guid>
      <dc:creator>jaalex101</dc:creator>
      <dc:date>2015-04-21T06:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152609#M42756</link>
      <description>&lt;P&gt;I don't see how you could put something inside a .csv file that is not recognized as content, and it seems that that's &lt;A href="http://stackoverflow.com/questions/1961006/can-a-csv-file-have-a-comment"&gt;the way it is&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 06:34:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152609#M42756</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-04-21T06:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152610#M42757</link>
      <description>&lt;P&gt;To do this, it must be a saved search... otherwise, you really have no way to attach the query at all if it's adhoc and you are back to cutting and pasting... And anything else would have to be done programatically... if you're game... basically you must save the search so that the info and entry is saved in &lt;CODE&gt;savedsearches.conf&lt;/CODE&gt; then you have two options... neither is a click away:&lt;/P&gt;

&lt;P&gt;the &lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEK2#viewpropssaved"&gt;PYTHON SDK&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEK2#viewpropssaved"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEK2#viewpropssaved&lt;/A&gt;&lt;BR /&gt;
Grab the value of the search= key word for the stanza matching the saved search and any other key words you want (dispatch.earliest_time etc)  Then open the cvs file you just wrote (or have your script find it as the latest one... etc) and add a "header" prefixed by a marker, say ## and then compose your header &lt;BR /&gt;
write the value of search=  and the others in the saved search stanza you are looking for and there you have it.&lt;/P&gt;

&lt;P&gt;You can also retrieve the search query info using the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTprolog"&gt;REST API&lt;/A&gt; and use the Configuration Endpoints... but you would then still have to mechanize the editing of your csv file so I'd go for python. it wouldn't be super complex.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 07:05:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152610#M42757</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-04-21T07:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152611#M42758</link>
      <description>&lt;P&gt;Thanks. My original question was for an adhoc query with a 1-click solution , but these pointers towards a programmatic approach for a saved search is good too. Marking as accepted.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 07:56:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152611#M42758</guid>
      <dc:creator>jaalex101</dc:creator>
      <dc:date>2015-04-21T07:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to include the ad hoc search and the time range it was run when exporting the results to CSV?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152612#M42759</link>
      <description>&lt;P&gt;open another question and explain that you'd like a way to export the "metadata" for a search with a click. Mark it as a feature request. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;Glad this helped... thank you for accepting.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 23:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-include-the-ad-hoc-search-and-the-time-range/m-p/152612#M42759</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-04-21T23:34:41Z</dc:date>
    </item>
  </channel>
</rss>

