Code Monkey home page Code Monkey logo

serverclass_converter's Introduction

serverclass_converter.py

Purpose

I am converting a set of standard serverclass files into CSV-type files for a customer. Creating all of those CSV files manually sounded awful, so this will do all of the tedious work for me.

System Requirements

This app was written in Python 3.x. PRs to make it work in Python 2.7 or below are weclome.

Usage

usage: serverclass_converter [-h] [-d] [-f CONFIG] [-s] [-a APP]

Convert serverclass white/blacklist entries into CSV files.

optional arguments:
  -h, --help                    show this help message and exit
  -d, --debug                   Enable debug logging.
  -f CONFIG, --config CONFIG    serverclass.conf configuration to process.
  -a APP, --app APP             App name for serverclass.conf output lookup files.
                                Defaults to app_serverclass.

Output

A valid Splunk app will be created in the current directory. It will be named after the --app option value. If you have a stanza "[serverClass:ServerList]", you will end up with two CSV files: ServerList.csv and ServerList_blacklist.csv. There will be a header row with the field name "host".

A serverclass.conf file will be created in local with the following content. The app name is the same as what is used to create the current app directory.

[serverClass:ServerList]
whitelist.from_pathname = etc/apps/app_serverclass/lookups/ServerList.csv
whitelist.select_field = host
blacklist.from_pathname = etc/apps/app_serverclass/lookups/ServerList_blacklist.csv
blacklist.select_field = host

Caveats

This program assumes you are feeding it a serverclass.conf that is valid for use in the Forwarder Management GUI of Splunk. No funny stuff.

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.