You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Go package config provides a ready to use parser for [Logstash](https://github.com/elastic/logstash) configuration files.
9
+
The Go package config provides a ready to use parser for Logstash ([github](https://github.com/elastic/logstash)) configuration files.
10
10
11
11
The basis of the grammar for the parsing of the Logstash configuration format is the original [Logstash Treetop grammar](https://github.com/elastic/logstash/blob/master/logstash-core/lib/logstash/config/grammar.treetop) which could be used with only minor changes.
12
12
@@ -22,10 +22,42 @@ go get -t github.com/breml/logstash-config/...
22
22
23
23
## Usage
24
24
25
-
### ls-config-check
25
+
### mustache
26
26
27
-
`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.
28
-
`ls-config-check <logstash-config-file>` could be used instead if `bin/logstash -f <logstash-config-file> -t`, which is orders of magnitude faster 😃.
27
+
`mustache` is a command line tool that allows to syntax check, lint and format Logstash configuration files. The name of
28
+
the tool is inspired by the original Logstash Logo ([wooden character with an eye-catching mustache](https://www.elastic.co/de/blog/high-level-logstash-roadmap-is-published)).
29
+
30
+
The `check` command verifies the syntax of Logstash configuration files:
31
+
32
+
```shell
33
+
mustache check file.conf
34
+
```
35
+
36
+
The `lint` command checks for problems in Logstash configuration files.
37
+
38
+
The following checks are performed:
39
+
40
+
* Valid Logstash configuration file syntax
41
+
* No comments in exceptional places (these are comments, that are valid by the Logstash configuration file syntax, but
42
+
but are located in exceptional or uncommon locations)
43
+
* Precence of an `id` attribute for each plugin in the Logstash configuration
44
+
45
+
If the `--auto-fix-id` flag is passed, each plugin gets automatically an ID. Be aware, that this potentially reformats
46
+
the Logstash configuration files.
47
+
48
+
```shell
49
+
mustache lint --auto-fix-id file.conf
50
+
```
51
+
52
+
With the `format` command, mustache returns the provided configuration files in a standardized format (indentation,
53
+
location of comments). By default, the reformatted file is print to standard out. If the flag `--write-to-source`
54
+
is provided, the Logstash config files are reformatted in place.
55
+
56
+
```shell
57
+
mustache format --write-to-source file.conf
58
+
```
59
+
60
+
Use the `--help` flag to get more information about the usage of the tool.
0 commit comments