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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...