When you upload an app, you should move everything out of local and into default. This is important because all changes that a user makes will be stored in local.
When your app is upgraded, all files in the appĀ (except local files) will be replaced, and the user's changes will be lost. The following Unix commands illustrate what needs to be done:
- First, let's copy our app to another location, perhaps /tmp:
cp -r $SPLUNK_HOME/etc/apps/is_app_one /tmp/
- Next, let's move everything from local to default. In the case of .xml files, we can simply move the files; but .conf files are a little more complicated, and we need to merge them manually. The following command does this:
cd /tmp/is_app_one mv local/data/ui/nav/*.xml default/data/ui/nav/ mv local/data/ui/views/*.xml default/data/ui/views/ #move conf files, but don't replace conf files in default mv -n local/*conf default/
- Now, we need to merge any .conf files that remain in local. The only configuration we have left is app.conf:
local/app.conf default/app.conf [ui] [launcher] [package] check_for_updates = 1 [install] is_configured = 0 [ui] is_visible = 1 label = Implementing Splunk App One [launcher] author = description = version = 1.0
Configuration merging is additive, with any values from local added to the values in default. In this case, the merged configuration would be as follows:
[install] is_configured = 0 [ui] Working with Apps [ 198 ] is_visible = 1 label = Implementing Splunk App One [launcher] author = description = version = 1.0 [package] check_for_updates = 1
- Place this merged configuration in default/app.conf and delete local/app.conf.
We will cover configuration merging extensively in Chapter 11, Configuring Splunk.