Getting Data In

How to move index from main to custom index?

test_qweqwe
Builder

Hello
I failed and miss index for nginx and all logs saved to main.

Now I created new index "nginx_logs" and how me move all nginx logs from "main" to my new index "nginx_logs"?

Tags (2)
0 Karma
1 Solution

woodcock
Esteemed Legend

You can only move all of them or none of them. Here is the process to move EVERYTHING from index=main to NEW index=nginx:

On the forwarders, stop the Splunk instances so that they will not be sending ANYTHING to the Indexer(s). Update the inputs.conf so that your stuff is going to go to the new index when you start Splunk there.

On each indexer:
/opt/splunk/bin/splunk stop
Update /opt/splunk/etc/apps/*/indexes.conf to add the new nginx index.
cd /opt/splunk/var/lib/splunk/
mv -f main.dat nginx.dat
mv -f defaultdb nginx
/opt/splunk/bin/splunk start

When Splunk starts, it will create a new main index that is empty. Restart Splunk on the forwarder so it starts sending to the new index.

View solution in original post

woodcock
Esteemed Legend

You can only move all of them or none of them. Here is the process to move EVERYTHING from index=main to NEW index=nginx:

On the forwarders, stop the Splunk instances so that they will not be sending ANYTHING to the Indexer(s). Update the inputs.conf so that your stuff is going to go to the new index when you start Splunk there.

On each indexer:
/opt/splunk/bin/splunk stop
Update /opt/splunk/etc/apps/*/indexes.conf to add the new nginx index.
cd /opt/splunk/var/lib/splunk/
mv -f main.dat nginx.dat
mv -f defaultdb nginx
/opt/splunk/bin/splunk start

When Splunk starts, it will create a new main index that is empty. Restart Splunk on the forwarder so it starts sending to the new index.

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...