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 738f2c6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .github/workflows/test_config_syntax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on: [push]
jobs:
test-syntax:
runs-on: ubuntu-latest
container:
image: logstash:8.12.0
volumes:
- $(pwd)/../../postfix.grok:/etc/logstash/patterns.d/postfix.grok
- $(pwd)/../../50-filter-postfix.conf:/usr/share/logstash/pipeline/50-filter-postfix.conf
steps:
- name: Validate configuration file syntax
run: 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,6 @@
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 738f2c6

Please sign in to comment.