GithubHelp home page GithubHelp logo

nextpart / spl-manager Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 1.0 457 KB

This library is an abstraction for Splunk-related development, maintenance, or migration operations. It provides a single CLI or SDK to conveniently perform various operations such as managing a local development container, retrieving sample-data, building applications, comparing instances, managing knowledge objects and much more in the future.

License: GNU General Public License v3.0

Python 81.11% Jupyter Notebook 17.10% Dockerfile 0.49% Shell 1.30%
splunk splunk-enterprise splunk-cloud splunk-cli

spl-manager's Introduction

Splunk Management Utility

๐Ÿค Show your support - give a โญ๏ธ if you liked the tool | Share on | Follow us on


License: GPL v3


This library is an abstraction for Splunk-related development, maintenance, or migration operations. It provides a single CLI or SDK to conveniently perform various operations such as managing a local development container, retrieving sample-data, building applications, comparing instances, managing knowledge objects and hopefully much more in the future.

Motivation ๐Ÿ”ฅ

When I work with Splunk, my working directory is usually in the same layout. I work with a mono-repository or a higher-level one with submodules, which contains several applications and configuration. This can look generalized like this:

<Development Repository>
โ”œโ”€โ”€ apps                          # Folder where to store applications
โ”‚   โ””โ”€โ”€ Defender_TA_nxtp          # Generic custom Splunk app
โ”œโ”€โ”€ dist                          # Place for built packages and reports
โ”œโ”€โ”€ scripts
โ”œโ”€โ”€ config                        # Settings and secrets
โ”‚   โ””โ”€โ”€ settings.yaml             # General purpose settings for this lib
โ”‚   โ””โ”€โ”€ .secrets.yaml             # API settings for connections and secrets
โ””โ”€โ”€ share                         # Custom splunkbase or builtin app content

We have all found our ways and methods to develop applications on an instance and to configure and operate that instance to meet our needs and/or those of our customers. But what is usually rather painful is when we then need them on other instances as well. A good example are test instances, which should be as close to production as possible. However, in the last few years that I have been dealing as a user with Splunk, some needs for simplified handling and automation have emerged that I would like to address here.

We want to ...

  • Spin up a local development container:

    spl docker start
  • Put my local application(s) there for testing purposes:

    spl docker upload --app="Defender*"
  • Get sample data for Eventgen:

    spl --src="onprem"  samples --path="./apps/SA-Eventgen" download --name="WinDefender"
  • (De)activate streaming of event data.

  • Download apps from development container to local folder:

    spl docker download --app="Defender*"
  • Run AppInspect, Packaging, etc.:

    spl apps --name="Defender_TA*" validate
  • List various objects on an instance:

    spl manager --conn="onprem" users list
  • Create or modify objects on an instance:

    spl manager --conn="onprem" roles update --name "investigator"
  • Sync objects and their properties from one instance to another:

    spl --src="onprem" --dest="localhost" sync users --create --update

and probably much more, so pull requests are welcome!

Getting Started ๐Ÿš€

You can download the package from the package feed via pip install spl-manager or install from source with poetry after cloning the repository.

Then you can issue your first command to get the help page:

python -m spl -h

or poetry run python -m spl -h. Anyhow it's recommended to set the alias spl="python -m spl for easier handling.

You have to create a config\.secrets.yaml file by using the config\template.secrets.yaml file, which contains the credentials for the Development Docker-Container and Splunkbase.

Using the library ๐Ÿ“š

Please note that, when using the library as an SDK you need to pass the interactive=False flag to not run into issues because in interactive mode it asks for user inputs via CLI methods.

from spl import SplManager

spl = SplManager(interactive=False)

Using the CLI ๐Ÿง‘โ€๐Ÿ’ป

If you wish to get more information about any command within spl, you can pass the -h parameter.

Top-level spl Options

  • --interactive: Wether or not to run in interactive mode.
  • --src: The name of the source connection provided in settings.
  • --dest: The name of the destination connection provided in settings.

Top-level spl Modules

  • connections provides you a list of connections available via configuration.

  • docker helps you to manage the local splunk container instance.

  • apps abstracts the handling of local application folders at a given --path and helps with validation, packaging, vetting, etc.

  • samples are based on the configured queries for a --conn or --src and can download results and store them automatically at a --path to use for SA-Eventgen.

  • manager acts as a direct ConnectionAdapter interface for the specified --conn parameter.

  • sync will handle managers for --src and --dest connections, enabling you to compare, move and update between those instances.

๐Ÿ”— References

๐Ÿคฉ Support

Support via PayPal or send us some crypto:

Protocol Address
Ethereum 0xcFC6Bdb68FB219de754D01BcD34F8A339549C910
Avalanche X-avax1vlrw8m9af5p4kx2zxc4d5lqmgh8c86uduwprg6
Harmony one18fcze47fll6662ggr760u9jm3rfz859jkv7vyw
Binance Chain bnb1q6zg3pnmclnfhy6vtldfd0az97l0ndayun2tzn
Binance Smart Chain 0x1CD0ca3eC911Fe9661905Dd500FBaCE245c7013f
Solana Eh35fdT6gdMHcsj3TrTMnNDSgvWAEMc11Zhz9R96F7aB

spl-manager's People

Contributors

k0dit avatar n0mer1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

trellixvulnteam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.