Skip to content

Validate config syntax #193

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/test_config_syntax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Validate configuration syntax
on: [push]
jobs:
test-syntax:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker run --rm \
--volume ./postfix.grok:/etc/logstash/patterns.d/postfix.grok \
--volume ./50-filter-postfix.conf:/usr/share/logstash/pipeline/50-filter-postfix.conf \
logstash:8.12.0 \
logstash --config.test_and_exit -f /usr/share/logstash/pipeline/50-filter-postfix.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Test grok patterns
on: [push]
jobs:
test:
test-patterns:
runs-on: ubuntu-latest

steps:
8 changes: 5 additions & 3 deletions ALTERNATIVE-INPUTS.md
Original file line number Diff line number Diff line change
@@ -7,9 +7,11 @@ Various other Logstash filters can produce the needed input fields (`program` an
----------------

```
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST} %{DATA:program}(?:\[%{POSINT}\])?: %{GREEDYDATA:message}" }
overwrite => ["timestamp", "message"]
filter {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST} %{DATA:program}(?:\[%{POSINT}\])?: %{GREEDYDATA:message}" }
overwrite => ["timestamp", "message"]
}
}
```

9 changes: 9 additions & 0 deletions test_config_syntax.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -eux

docker run --rm -it \
--volume $(pwd)/postfix.grok:/etc/logstash/patterns.d/postfix.grok \
--volume $(pwd)/50-filter-postfix.conf:/usr/share/logstash/pipeline/50-filter-postfix.conf \
logstash:8.12.0 \
logstash --config.test_and_exit -f /usr/share/logstash/pipeline/50-filter-postfix.conf
File renamed without changes.