bpaquet / node-logstash

Simple logstash implmentation in nodejs : file log collection, sent with zeromq
Other
517 stars 141 forks source link

grok filter crashes process on Alpine 3.8 #151

Open nhnicwaller opened 5 years ago

nhnicwaller commented 5 years ago

I'm trying to install node-logstash in a Docker container based on Alpine Linux. Ideally I would like to use node-logstash within app containers to preprocess logs (trimming and structuring) before they are sent to my central log aggregation server.

I was able to get it working with the most basic pipeline configuration (stdin -> stdout) but when I add a grok pattern, the process immediately crashes on startup, as shown below.

[Sat, 08 Dec 2018 19:21:39 GMT] NOTICE Starting node-logstasth-agent 0.0.5
[Sat, 08 Dec 2018 19:21:39 GMT] INFO Max http socket 100
[Sat, 08 Dec 2018 19:21:39 GMT] INFO Loading config file : /opt/logstash/pipeline.conf
[Sat, 08 Dec 2018 19:21:39 GMT] INFO File loaded, 3 urls found
[Sat, 08 Dec 2018 19:21:39 GMT] INFO Loading config : 6 urls
[Sat, 08 Dec 2018 19:21:39 GMT] INFO Initializing output Stdout
[Sat, 08 Dec 2018 19:21:39 GMT] INFO Initializing filter AddHost
[Sat, 08 Dec 2018 19:21:39 GMT] INFO Initializing filter AddTimestamp
[Sat, 08 Dec 2018 19:21:39 GMT] INFO Initializing filter AddVersion

#
# Fatal error in ../deps/v8/src/api.cc, line 1249
# Check failed: !value_obj->IsJSReceiver() || value_obj->IsTemplateInfo().
#

The Dockerfile is very simple.

FROM alpine:3.8
RUN apk add --update make g++ python2 nodejs-npm \
  && mkdir -p /opt/logstash \
  && cd /opt/logstash \
  && npm install --no-optional moment@2.9.0 oniguruma@5.1.x node-logstash
ADD pipeline.conf /opt/logstash/pipeline.conf
CMD ["/opt/logstash/node_modules/.bin/node-logstash-agent", "--config_file", "/opt/logstash/pipeline.conf" ]

The pipeline.conf is also simple.

input { stdin {} }
filter { grok { match => "" } }
output { stdout {} }

With the files shown above, here are the steps to reproduce.

docker build --tag node-logstash .
docker run --rm -it node-logstash