Getting Data In

incorrect host names

lain179
Communicator

I extracted the host names wrong, and now I have extra names in my Splunk. Example: Server01 vs. Server1 and Server02 vs. Server2, etc.

What's the best way to fix this so I only have Server01, Server02, etc.? Delete? Rename? Any suggestions?

Thanks!

Tags (1)
0 Karma
1 Solution

stefandagerman
Path Finder

If you don't want to or cannot reindex your data, I would probably use tags or create a new field with an appropriate RegEx that normalizes your server names. You'd then use the tag or new field name in your searches rather than the original server name.

View solution in original post

stefandagerman
Path Finder

If you don't want to or cannot reindex your data, I would probably use tags or create a new field with an appropriate RegEx that normalizes your server names. You'd then use the tag or new field name in your searches rather than the original server name.

lain179
Communicator

Ok, thanks!

0 Karma

stefandagerman
Path Finder

Yes you can, with a userid that has can_delete privilege (admin does not have that by default).
Construct a search that returns all events you want deleted, make sure the result is what you expect and add "| delete" once you are sure.
Note that events will not be deleted physically, so if you want to reclaim the disk space immediately, I think you would have to delete and recreate the index and re-index everything.

0 Karma

lain179
Communicator

I don't need those logs with wrong host names as I re-import the data with correct host names. So can I just delete them? Is there a way to selectively delete indexed data?

0 Karma

stefandagerman
Path Finder

Note that that new field won't be indexed like the 'host' field is.

0 Karma

kristian_kolb
Ultra Champion

You cannot rename the host field, once it's been indexed. However, you can dynamically change it as part of the search for the duration of that search. (say you indexed server1.domain.com, buy you just wanted the server1)

... | rex field=host "(?<host>[^.]+)" | ...

Not really neat. Will probably have effects on drill-downs etc, where the new host field value won't match indexed data....Other than that, wait until the data ages out of your index.. or delete and re-index.

/K

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

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, ...