Splunk Search
Highlighted

merging local into default using git

Motivator

I would like to periodically merge stuff in /local into /default and then delete whatever is in /local
I have a repository per app and a remote git server
I think it should be possible to merge these two subfolders with /local winning over /default but i am severely lacking in git knowledge so please be gentle 🙂

clarification:
The idea is to merge UI generated changes back into default (on INTG), push it to the central git and then pull the repo version to a splunk PROD stage ( /etc/apps or /etc/deployment-apps or /etc/cluster-apps or whatever was the path again).

Mostly for app maintainers updating searches and knowledge objects on the GUI with no shell access.

Tags (2)
Highlighted

Re: merging local into default using git

Super Champion

hi mate, why you merge into "default" ? Better to keep within "local" of your app.
You doing this for SH cluster?

Also the merging shouldn't be done using git, but you should look into btool

0 Karma
Highlighted

Re: merging local into default using git

Motivator

open for pointers

essentially i want to merge all changes by non admins with shell and vi 🙂 into the default

0 Karma
Highlighted

Re: merging local into default using git

Motivator

It is generally not recommended to have your local changes in the default folder, as any App Update will break your individual settings.

Are there any special reasons for you to not keep the local configs?

0 Karma
Highlighted

Re: merging local into default using git

Motivator

The idea is to merge UI generated changes back into default (on INTG), push it to the central git and then pull the repo version to a splunk PROD stage ( /etc/apps or /etc/deployment-apps or /etc/cluster-apps or whatever was the path again).

Mostly for app maintainers updating searches and knowledge objects on the GUI with no shell access.

I will update the question to clarify

0 Karma
Highlighted

Re: merging local into default using git

SplunkTrust
SplunkTrust

You can use Splunk for the merge, call the /services/apps/local/<name>/package endpoint to generage a .spl file with local and default merged together into default.

To be lazy, you can use the App Exporter: https://splunkbase.splunk.com/app/2613/

0 Karma
Highlighted

Re: merging local into default using git

Motivator

ok, but this won't touch the app itself so i can not work with git directly etc.

0 Karma
Highlighted

Re: merging local into default using git

SplunkTrust
SplunkTrust

I don't see why not. Package app, put content of .spl wherever you commit to git from, commit to git.

0 Karma
Highlighted

Re: merging local into default using git

Motivator

hm, yeah kinda look ok-ish. The idea was to work with a repository equaling an app and work directly with it in /etc/apps for instance.

The general workflow is supposed to be
1. fork app from template in bitbucket
2. clone repo into /etc/apps (or /etc/deployment-apps or /etc/master-apps) on a development stage
3. edit the app, in the case of an ui app via splunk web-ui (power users)
4. merge changes, clean stuff in local
5. push changes into git
6. clone or update app into a production stage into the apropriate structure and refresh leading to usable app in ui or app being deployed via cluster or deployment method

we keep a separate gitdir so there is no git cluter in the repo itself.

Do i make sense?

I guess i can do what you suggest and take the "detour" via /package of which i was not aware

0 Karma
Highlighted

Re: merging local into default using git

SplunkTrust
SplunkTrust

It makes sense, I'm just not aware of something apart from the package endpoint that has the local-to-default merge logic already built.

0 Karma