AlticeLabsProjects / nginx-log-zmq

nginx module to log messages over ZeroMQ
MIT License
64 stars 16 forks source link

openresty/nginx does not recognize zmq directives #20

Open steebchen opened 6 years ago

steebchen commented 6 years ago

I want to build this module with openresty.

My commands look exactly like the instructions:

./configure --add-module=../nginx-log-zmq-master
make
make install

However, when running nginx with any zmq directive like log_zmq_server, nginx aborts on start:

$ /usr/local/openresty/bin/openresty
> 2018/11/03 21:06:06 [emerg] 1#0: unknown directive "log_zmq_server" in /usr/local/openresty/nginx/conf/nginx.conf:13

I am sure that the compiling itself works, because the logs show that it was compiled correctly, and it reported an error before because of missing dependencies (libzmq3-dev):

adding module in /openresty-1.13.6.1/../nginx-log-zmq-master
checking for ZeroMQ library ... found
 + ngx_http_log_zmq_module was configured
[...]

The full log output is available at https://paste.ee/p/BCdf6.

My dockerfile:

FROM ubuntu:xenial

RUN apt-get -y update \
  && apt-get -y upgrade \
  && apt-get install -y \
  libpcre3 \
  libpcre3-dev \
  libssl-dev \
  libperl4-corelibs-perl \
  libzmq3-dev \
  g++ \
  cmake \
  unzip \
  wget \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*

RUN wget https://github.com/openresty/openresty/releases/download/v1.13.6.1/openresty-1.13.6.1.tar.gz \
  && wget https://github.com/alticelabs/nginx-log-zmq/archive/master.zip \
  && unzip master.zip \
  && rm master.zip \
  && tar -xvf openresty-1.13.6.1.tar.gz \
  && rm openresty-1.13.6.1.tar.gz \
  && cd openresty-1.13.6.1/ \
  && ./configure --add-module=../nginx-log-zmq-master -j2 \
  && make -j2 \
  && make install \
  && cd .. \
  && rm -r openresty-1.13.6.1 \
  && rm -r nginx-log-zmq-master

# connect stdout & stderr
RUN ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
  && ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log

COPY cmd.sh /usr/bin/cmd.sh
RUN chmod +x /usr/bin/cmd.sh

# copy configs
COPY *.conf /usr/local/openresty/nginx/conf/
COPY *.lua /usr/local/openresty/nginx/lua/

CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]

Any suggestion is appreciated. I also tried with an older version which is officially supported, namely v1.5.12.1.

blacktek commented 5 years ago

Any update on this issue opened 1 year ago?I've the same problem.

steebchen commented 5 years ago

@blacktek You should search for other solutions. Don't rely on plugins which are not actively maintained.

blacktek commented 5 years ago

Can you recommend something to forward data from nginx to zmq? I've not found anything

steebchen commented 5 years ago

Nope, sorry. I have chosen a different path for this project back then where I've used varnish on top of nginx which has propper logging tools, and then you can easily stream logs by using /usr/bin/varnishncsa and then use any language to to whatever you want with the logs :) Probably not the best and not the most performant solution, but it works. Nowadays, this project is abandoned though (due to other reasons).

carlosefr commented 5 years ago

Yes, this module is no longer maintained AFAIK. Perhaps if you're using openresty you can use a zmq library for lua to accomplish the same thing.