Skip to content

Commit

Permalink
Add validation for the logstash configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
whyscream committed Feb 4, 2024
1 parent bc64147 commit 10dfac9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
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:
Expand Down
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.

0 comments on commit 10dfac9

Please sign in to comment.