<?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: Move logs to another Index in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13331#M1178</link>
    <description>&lt;P&gt;Yes.  This can be done, the question is how badly do you need to move the data.  As of Splunk 4.x, you can search multiple indexes at once, so this is often not a big deal.  If however, you cannot find a way around moving your events from one index to another, than the following may be of help:&lt;/P&gt;

&lt;P&gt;Events can be exported and imported using &lt;CODE&gt;exporttool&lt;/CODE&gt; and &lt;CODE&gt;importtool&lt;/CODE&gt;.  Which is one way of moving events from one index to another, but this can be a fairly daunting task.  Especially if you are trying to move a source or sourcetype that splunk has been indexing for a long period of time.  &lt;/P&gt;

&lt;P&gt;Essentially, these tools can be used to import and export the content of a bucket using a simple CSV file format.  You can export the content of one bucket (from you existing index) and then import those events into a bucket (in your desired index).  If your source/sourctype to be moved exists across multiple buckets in your source index, then you will have to deal with each bucket individually.  (This is where it starts to get really ugly, time-consuming, and potentially dangerous to your data if you screw up...)&lt;/P&gt;

&lt;P&gt;If you are looking to only move a few sources/sourcetypes, then you may be able to do so by simply indicating the source/sourcetype when calling &lt;CODE&gt;exporttool&lt;/CODE&gt;, otherwise you may need to export all the events (using &lt;CODE&gt;meta::all&lt;/CODE&gt;) and write a small CSV-processing script/utility of some kind to sift out the events you want to migrate to a different index.&lt;/P&gt;

&lt;P&gt;For example, if you are trying to move the sourcetype &lt;CODE&gt;WinEventLog:Application&lt;/CODE&gt; from the &lt;CODE&gt;main&lt;/CODE&gt; (&lt;CODE&gt;default&lt;/CODE&gt;) index to the &lt;CODE&gt;os&lt;/CODE&gt; index, something like this could get you started:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;&lt;CODE&gt;splunk cmd exporttool defaultdb/db_1262807912_1262278800_6 /dev/stdout -csv sourcetype::WinEventLog:Application | splunk cmd importtool os/db_temp /dev/stdin&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Of course at this point we have only copied the events.  You still have to remove the events from the source bucket.  After that, you would need to remove the events from your default index, and rename the &lt;CODE&gt;db_temp&lt;/CODE&gt; bucket with an appropriate name (see the script on the wiki page linked below)&lt;/P&gt;

&lt;P&gt;You may find some additional information here:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://www.splunk.com/wiki/Community:Modifying_indexed_data_via_export_and_import" rel="nofollow"&gt;http://www.splunk.com/wiki/Community:Modifying_indexed_data_via_export_and_import&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;  As of Splunk 4.1.4(ish) the &lt;CODE&gt;meta::all&lt;/CODE&gt; is not longer recognized by the &lt;CODE&gt;exporttool&lt;/CODE&gt; command.  Simply omitting that option should result in all events being exported.&lt;/P&gt;</description>
    <pubDate>Thu, 13 May 2010 20:42:43 GMT</pubDate>
    <dc:creator>Lowell</dc:creator>
    <dc:date>2010-05-13T20:42:43Z</dc:date>
    <item>
      <title>Move logs to another Index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13329#M1176</link>
      <description>&lt;P&gt;Is there any way to move log data to another index after it has already been indexed?&lt;/P&gt;

&lt;P&gt;Example..  &lt;/P&gt;

&lt;P&gt;Windows logs were indexed into the main(default) index. I would like to move the data from that one host into another index.&lt;/P&gt;

&lt;P&gt;Running Splunk 4.0.11&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2010 21:54:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13329#M1176</guid>
      <dc:creator>JHill</dc:creator>
      <dc:date>2010-05-12T21:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Move logs to another Index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13330#M1177</link>
      <description>&lt;P&gt;After data has been stored in an index, it can't be moved.  It can be deleted using the delete operator and then you could reload it into the proper index.  (If it came from a flat-file or other simple reloadable source).  &lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2010 04:56:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13330#M1177</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2010-05-13T04:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Move logs to another Index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13331#M1178</link>
      <description>&lt;P&gt;Yes.  This can be done, the question is how badly do you need to move the data.  As of Splunk 4.x, you can search multiple indexes at once, so this is often not a big deal.  If however, you cannot find a way around moving your events from one index to another, than the following may be of help:&lt;/P&gt;

&lt;P&gt;Events can be exported and imported using &lt;CODE&gt;exporttool&lt;/CODE&gt; and &lt;CODE&gt;importtool&lt;/CODE&gt;.  Which is one way of moving events from one index to another, but this can be a fairly daunting task.  Especially if you are trying to move a source or sourcetype that splunk has been indexing for a long period of time.  &lt;/P&gt;

&lt;P&gt;Essentially, these tools can be used to import and export the content of a bucket using a simple CSV file format.  You can export the content of one bucket (from you existing index) and then import those events into a bucket (in your desired index).  If your source/sourctype to be moved exists across multiple buckets in your source index, then you will have to deal with each bucket individually.  (This is where it starts to get really ugly, time-consuming, and potentially dangerous to your data if you screw up...)&lt;/P&gt;

&lt;P&gt;If you are looking to only move a few sources/sourcetypes, then you may be able to do so by simply indicating the source/sourcetype when calling &lt;CODE&gt;exporttool&lt;/CODE&gt;, otherwise you may need to export all the events (using &lt;CODE&gt;meta::all&lt;/CODE&gt;) and write a small CSV-processing script/utility of some kind to sift out the events you want to migrate to a different index.&lt;/P&gt;

&lt;P&gt;For example, if you are trying to move the sourcetype &lt;CODE&gt;WinEventLog:Application&lt;/CODE&gt; from the &lt;CODE&gt;main&lt;/CODE&gt; (&lt;CODE&gt;default&lt;/CODE&gt;) index to the &lt;CODE&gt;os&lt;/CODE&gt; index, something like this could get you started:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;&lt;CODE&gt;splunk cmd exporttool defaultdb/db_1262807912_1262278800_6 /dev/stdout -csv sourcetype::WinEventLog:Application | splunk cmd importtool os/db_temp /dev/stdin&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Of course at this point we have only copied the events.  You still have to remove the events from the source bucket.  After that, you would need to remove the events from your default index, and rename the &lt;CODE&gt;db_temp&lt;/CODE&gt; bucket with an appropriate name (see the script on the wiki page linked below)&lt;/P&gt;

&lt;P&gt;You may find some additional information here:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://www.splunk.com/wiki/Community:Modifying_indexed_data_via_export_and_import" rel="nofollow"&gt;http://www.splunk.com/wiki/Community:Modifying_indexed_data_via_export_and_import&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;  As of Splunk 4.1.4(ish) the &lt;CODE&gt;meta::all&lt;/CODE&gt; is not longer recognized by the &lt;CODE&gt;exporttool&lt;/CODE&gt; command.  Simply omitting that option should result in all events being exported.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2010 20:42:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13331#M1178</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-05-13T20:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Move logs to another Index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13332#M1179</link>
      <description>&lt;P&gt;Is this still possible in Splunk 5 and 6?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2014 16:32:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Move-logs-to-another-Index/m-p/13332#M1179</guid>
      <dc:creator>peter_krammer</dc:creator>
      <dc:date>2014-11-25T16:32:16Z</dc:date>
    </item>
  </channel>
</rss>

