/logstash-config

logstash-config provides a parser and abstract syntax tree (AST) for the Logstash config format, written in Go

Primary LanguageGoApache License 2.0Apache-2.0

logstash-config : parser and abstract syntax tree for Logstash config files

Build Status Go Report Card
GoDoc License

Overview

The Go package config provides a ready to use parser for Logstash configuration files.

The basis of the grammar for the parsing of the Logstash configuration format is the original Logstash Treetop grammar which could be used with only minor changes.

logstash-config uses pigeon to generate the parser from the PEG (parser expression grammar). Special thanks to Martin Angers (mna).

This package is currently under development, no API guaranties.

Install

go get -t github.com/breml/logstash-config/...

Usage

ls-config-check

cmd/ls-config-check contains the source code for a small sample tool, which uses just allow to parse a given Logstash config file. If the file could be parsed successfully, the tool just exits with exit code 0. If the parsing fails, the exit code is non zero and a error message, indicating the location, where the parsing failed, is printed. ls-config-check <logstash-config-file> could be used instead if bin/logstash -f <logstash-config-file> -t, which is orders of magnitude faster 😃.

Rebuild parser

  1. Get and install pigeon.
  2. Run go generate in the root directory of this repository.

Author

Copyright 2017 by Lucas Bremgartner (breml)

License

Apache 2.0