Knowledge Management

how to move the source and sourcetype to other index

chrismok
Path Finder

As the title. I want to rename the sourcetype from A to B, and also move them to other index. Is that possible to do it?

I tried to use this command

sourcetype=old_log
| EVAL sourcetype=new_log
| COLLECT index=new_index

But I found that the source will be changed like this "C:\\Program Files\\Splunk\\var\\spool\\splunk\\76dea59b6fcaa8e5_events.stash_new" and sourcetype will be changed to "stash".

0 Karma

jrodman
Splunk Employee
Splunk Employee

There is no feature to move events from one index to another.

You can try to use the summary indexing feature (one component is provided as the collect command) to cause new events to be created with the same text in them in a different index, but this is not at all the same as moving the events. You're seeing some of the differences.

Without altering events, you can use the 'rename=X' feature in the configuration of a sourcetype to alias all the events of that sourcetype to another sourcetype. This is typically useful as a cleanup action when the sourcetype you have your data under was an accident or is no longer wanted forevermore. It does not address your moving events goal.

The only way to really achieve "moving" events with full fidelity is quite laborious, and involves exporting the events to csv, and then importing them to a new bucket that you place in your new index, followed by hiding the original events with the |delete command. For most scenarios, reindexing the data to the desired index is more efficient on user time.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...