ChrisYounger / config_explorer

Config viewer and file editor for Splunk. Based on VSCode.
GNU Affero General Public License v3.0
28 stars 7 forks source link
splunk

Config Explorer

screenshot

This app provides a modern editor interface for viewing and editing Splunk files. It has code completion and tooltip hinting for '.conf' files (by loading the Splunk '.spec' files). The code gutter highlights if the line can be found in the btool output or not. By default, the app is not able to save files, but this can be enabled from the "Settings" link. As this app essentially provides unrestricted access to the Splunk files, users must have "admin_all_objects" capability. The editor is Microsoft Monaco editor (Visual Studio Code).

This app can optionally version control all changes by committing them to a git repository before and after saving. To use this you need to have "git" installed (not provided by this app) and you need to setup a git repository using the instructions below.

Important warnings:

There is some basic audit logging here: index=_internal source="*config_explorer.log"

Copyright (C) 2020 Chris Younger | Source code | Feature requests and bugs | Splunkbase

Using git auto-commit

Before enabling the git auto-complete feature you must first create a git repository somewhere. For example:

$ cd /opt/splunk/etc
$ git init

You will probably also need to set a username and email address for config_explorer to use for commits:

git config user.name config_explorer
git config user.email config_explorer@splunk.acme.com

If you wish to use a non-standard git repository location, you can set these environment variables:

export GIT_DIR=/opt/splunk/.git/
export GIT_WORK_TREE=/opt/splunk/

You will need to consider your .gitignore file. If your directory already has .gitignore files in it, you may instead need to make a .gitignore file that ignores deeper nested .gitignore files.

Finally, if you want to push changes to an external repo, I would recommend you create a script input to do so, or alternatively, see my custom git app here: https://splunkbase.splunk.com/app/4182/

Locking it down

In order to prevent file editing semi-permanantly, set write_access = false and hide_settings = true. This will prevent being able to change settings until someone changes files directly on the filesystem.

Third party software

The following third-party libraries are used by this app. Thank you!