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 bbec6b0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/test_config_syntax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate configuration syntax
on: [push]
jobs:
test-syntax:
runs-on: ubuntu-latest
container:
image: logstash:8.12.0
volumes:
- postfix.grok:/etc/logstash/patterns.d/postfix.grok
- 50-filter-postfix.conf:/usr/share/logstash/pipeline/50-filter-postfix.conf
steps:
- uses: actions/checkout@v4
- run: |
docker run --rm -it \
--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 bbec6b0

Please sign in to comment.