Skip to content

Commit 858e0eb

Browse files
authored
Merge pull request #193 from whyscream/validate-config-syntax
Validate config syntax
2 parents e0e8cf5 + 10dfac9 commit 858e0eb

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Validate configuration syntax
2+
on: [push]
3+
jobs:
4+
test-syntax:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- run: |
9+
docker run --rm \
10+
--volume ./postfix.grok:/etc/logstash/patterns.d/postfix.grok \
11+
--volume ./50-filter-postfix.conf:/usr/share/logstash/pipeline/50-filter-postfix.conf \
12+
logstash:8.12.0 \
13+
logstash --config.test_and_exit -f /usr/share/logstash/pipeline/50-filter-postfix.conf
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
name: Test grok patterns
12
on: [push]
23
jobs:
3-
test:
4+
test-patterns:
45
runs-on: ubuntu-latest
56

67
steps:

ALTERNATIVE-INPUTS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ Various other Logstash filters can produce the needed input fields (`program` an
77
----------------
88

99
```
10-
grok {
11-
match => { "message" => "%{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST} %{DATA:program}(?:\[%{POSINT}\])?: %{GREEDYDATA:message}" }
12-
overwrite => ["timestamp", "message"]
10+
filter {
11+
grok {
12+
match => { "message" => "%{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST} %{DATA:program}(?:\[%{POSINT}\])?: %{GREEDYDATA:message}" }
13+
overwrite => ["timestamp", "message"]
14+
}
1315
}
1416
```
1517

test_config_syntax.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
docker run --rm -it \
6+
--volume $(pwd)/postfix.grok:/etc/logstash/patterns.d/postfix.grok \
7+
--volume $(pwd)/50-filter-postfix.conf:/usr/share/logstash/pipeline/50-filter-postfix.conf \
8+
logstash:8.12.0 \
9+
logstash --config.test_and_exit -f /usr/share/logstash/pipeline/50-filter-postfix.conf
File renamed without changes.

0 commit comments

Comments
 (0)