@@ -7,10 +7,10 @@ OUTPUT=$(mktemp tmp.logstash.out.XXXXX)
7
7
PIPELINE=$( mktemp tmp.logstash.pipeline.XXXXX)
8
8
9
9
echo Preparing input data
10
- echo " postfix/smtp[123]: 7EE668039: to=<[email protected] >, relay=127.0.0.1[127.0.0.1]:2525, delay=3.6, delays=0.2/0.02/0.04/3.3, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 153053D)" > $INPUT
10
+ echo " postfix/smtp[123]: 7EE668039: to=<[email protected] >, relay=127.0.0.1[127.0.0.1]:2525, delay=3.6, delays=0.2/0.02/0.04/3.3, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 153053D)" > " $INPUT "
11
11
12
12
echo Preparing pipeline config
13
- cat > $PIPELINE << EOF
13
+ cat > " $PIPELINE " << EOF
14
14
input {
15
15
file {
16
16
path => "/tmp/logstash.in"
@@ -26,9 +26,9 @@ filter {
26
26
}
27
27
EOF
28
28
29
- cat 50-filter-postfix.conf >> $PIPELINE
29
+ cat 50-filter-postfix.conf >> " $PIPELINE "
30
30
31
- cat >> $PIPELINE << EOF
31
+ cat >> " $PIPELINE " << EOF
32
32
output {
33
33
file {
34
34
path => "/tmp/logstash.out"
38
38
39
39
echo Starting logstash docker container
40
40
CONTAINER_ID=$( docker run --rm --detach \
41
- --volume ./${INPUT} :/tmp/logstash.in \
42
- --volume ./${OUTPUT} :/tmp/logstash.out \
41
+ --volume ./" ${INPUT} " :/tmp/logstash.in \
42
+ --volume ./" ${OUTPUT} " :/tmp/logstash.out \
43
43
--volume ./postfix.grok:/etc/logstash/patterns.d/postfix.grok \
44
- --volume ./${PIPELINE} :/usr/share/logstash/pipeline/pipeline.conf \
44
+ --volume ./" ${PIPELINE} " :/usr/share/logstash/pipeline/pipeline.conf \
45
45
logstash:8.12.0 \
46
46
logstash -f /usr/share/logstash/pipeline/pipeline.conf)
47
47
48
- echo -n " Waiting for output from logstash "
49
- until test -s $OUTPUT ; do
50
- echo -n " ."
48
+ printf " Waiting for output from logstash "
49
+ until test -s " $OUTPUT " ; do
50
+ printf " ."
51
51
sleep 2
52
52
done
53
53
echo
54
54
55
- docker stop --time 1 $CONTAINER_ID > /dev/null
55
+ docker stop --time 1 " $CONTAINER_ID " > /dev/null
56
56
57
- if test " $( jq .tags[0] $OUTPUT ) " = ' "_grok_postfix_success"' ; then
57
+ if test " $( jq .tags[0] " $OUTPUT " ) " = ' "_grok_postfix_success"' ; then
58
58
echo Grok processing successful!
59
- jq . $OUTPUT
59
+ jq . " $OUTPUT "
60
60
else
61
61
echo " Grok processing failed :<"
62
- jq . $OUTPUT
62
+ jq . " $OUTPUT "
63
63
exit 1
64
64
fi
65
65
66
66
echo Cleaning up
67
- rm -f $INPUT $OUTPUT $PIPELINE
67
+ rm -f " $INPUT " " $OUTPUT " " $PIPELINE "
68
68
69
- echo Done
69
+ echo Done
0 commit comments