Refine your search:

I want to know how to replace a value inside in index permanently. I know I can use replace to replace it during search time but want to modify the actual value inside the index permanently.

I need this as equipment hostnames may change but I want to keep historical data for that host under the same indexed value.

asked 21 Mar '12, 10:10

llow's gravatar image

llow
201
accept rate: 0%


One Answer:

Splunk is unlike a relational-database in that once a value is written to the index, it cannot be removed/replaced surgically.

Thus, for historical data, you will need to reindex the data in question and then use a SED command to do the replacement:

http://docs.splunk.com/Documentation/Splunk/4.3.1/Data/Anonymizedatausingconfigurationfiles#Through_a_sed_script

Unless you reindex your old data, the replacement will be effective only for data going forward.

link

answered 21 Mar '12, 10:39

araitz's gravatar image

araitz ♦
7.9k3925
accept rate: 45%

edited 21 Mar '12, 10:40

Eww, there is no easier way to do this? I wanted to automate the process when a hostname change is made in our core monitoring system.

(21 Mar '12, 10:42) llow

You could use tags on the host field, or normalize hostnames using search-time extractions. Both these approaches solve your problem without permanently replacing indexed values.

http://docs.splunk.com/Documentation/Splunk/4.3.1/Knowledge/Tagthehostfield

http://docs.splunk.com/Documentation/Splunk/4.3.1/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles

(21 Mar '12, 10:54) araitz ♦

You could also create a lookup table that maps ip addresses (or old hostnames) to current hostnames. Set it as an automatic lookup and you will always have a field that represents the current hostname. You will only have to maintain a text file (CSV) of the mapping - and you could automate the update of the CSV file.

http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Aboutlookupsandfieldactions

(21 Mar '12, 15:00) lguinn ♦
Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×452

Asked: 21 Mar '12, 10:10

Seen: 360 times

Last updated: 21 Mar '12, 19:52

Copyright © 2005-2012 Splunk Inc. All rights reserved.