Re: Nginx + Syslog Question

2022-04-17 Thread David Anthony

Thank you Stuart - this worked wonderfully!

(I did have to mkdir /var/www/dev)

Respectfully,
David Anthony

On 4/17/22 05:54, Stuart Henderson wrote:

rcctl set syslogd flags -a /var/www/dev/log


Re: Nginx + Syslog Question

2022-04-17 Thread Stuart Henderson
On 2022-04-17, David Anthony  wrote:
> I'm trying to send Nginx access logs to syslog. I've tried examples in 
> the default nginx configuration file and man page to no avail. Can 
> anyone help identify why I'm not seeing access logs?

It runs in /var/www chroot, and uses its own code to write to the
/dev/log unix socket (rather than using the OS syslog functions
which don't require the socket as there is a different interface
with the kernel).)

So you need to set syslogd to create a socket in the chroot:

rcctl set syslogd flags -a /var/www/dev/log


-- 
Please keep replies on the mailing list.



Nginx + Syslog Question

2022-04-16 Thread David Anthony

Hello List,

I'm trying to send Nginx access logs to syslog. I've tried examples in 
the default nginx configuration file and man page to no avail. Can 
anyone help identify why I'm not seeing access logs?


Respectfully,

David Anthony

- - -

*syslog.conf*

|*.notice;auth,authpriv,cron,ftp,kern,lpr,mail,user.none /var/log/messages
kern.debug;syslog,user.info /var/log/messages
auth.info /var/log/authlog
authpriv.debug /var/log/secure
cron.info /var/cron/log
daemon.info /var/log/daemon
ftp.info /var/log/xferlog
lpr.debug /var/log/lpd-errs
mail.info /var/log/maillog

|

*nginx.conf*

error_log syslog:server=unix:/dev/log,severity=notice;
worker_processes 1;
worker_rlimit_nofile 1024;
user www;

events {
    worker_connections 800;
}

http {
    include mime.types;
    default_type application/octet-stream;
    keepalive_timeout 65;
    server_tokens off;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  syslog:server=unix:/dev/log,severity=debug main;

    server {
    listen 80 default_server;
    server_name _;
    location / {
/            REMOVED/
    }
    }
}