So this is how I solved it,
I made nginx to log to syslog server and from syslog-ng to redis
here is my configuration
in nginx http
directive
log_format xxx_log_format '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
in nginx server
directive
access_log syslog:server=127.0.0.1:601 xxx_log_format;
in syslog-ng config
source s_syslog {
udp(
port(601)
);
};
destination d_redis {
redis(
host("REDIS-IP")
port(6379)
command("LPUSH", "access_logs", "${MESSAGE}")
);
};
log {
source(s_syslog);
destination(d_redis);
};