You are not logged in.
Hi,
I'm using passenger/nginx, installed using the `passenger-install-nginx-module` and I'm wondering how I connect this to journalctl for logging? I am currently logging to a file, e.g.
access_log logs/access.log combined;
Thanks
Samuel
Offline
What's the 'passenger-install-nginx-module'? How did you install it? How does it differ from the nginx package in the Arch repos? Actually, why aren't you using the nginx package in the Arch repos?
Offline
`passenger-install-nginx-module` is a script which installs passenger and nginx on (almost) any system (e.g. available in the community/passenger package). I've used it frequently in the past. I'm considering using the arch package for nginx, but haven't had a chance to look into it.
In any case, how does one output logging messages to journalctl? e.g. how does Apache do it?
Offline
How do you run nginx, after installing it with this script, instead of with pacman?
Offline
Just the same way, with a service:
[Unit]
Description=A high performance web server and a reverse proxy server
After=syslog.target network.target
[Service]
Type=forking
SyslogIdentifier=nginx
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/opt/nginx/sbin/nginx -s reload
ExecStop=/opt/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
Offline
OK - and there's nothing in the journal about it? What does 'systemctl status nginx' show? (I'm assuming that file you just posted is called nginx.service).
Offline
Yeah, the log files have entries (e.g. access log), but the journal just contains general crap:
# systemctl status nginx
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled)
Active: active (running) since Mon 2014-03-31 13:33:00 NZDT; 21min ago
Process: 29113 ExecStop=/opt/nginx/sbin/nginx -s stop (code=exited, status=0/SUCCESS)
Process: 29142 ExecStart=/opt/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 29123 ExecStartPre=/opt/nginx/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 29162 (nginx)
CGroup: /system.slice/nginx.service
|-29144 PassengerWatchdog
|-29147 PassengerHelperAgent
|-29152 PassengerLoggingAgent
|-29162 nginx: master process /opt/nginx/sbin/nginx
|-29163 nginx: worker process
|-29164 nginx: worker process
|-29165 nginx: worker process
`-29166 nginx: worker process
Mar 31 13:33:00 primary.foobar.co.nz nginx[29123]: nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
Mar 31 13:33:00 primary.foobar.co.nz nginx[29123]: nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
Mar 31 13:33:00 primary.foobar.co.nz systemd[1]: Failed to read PID from file /opt/nginx/logs/nginx.pid: Invalid argument
Mar 31 13:33:00 primary.foobar.co.nz systemd[1]: Started A high performance web server and a reverse proxy server.
Offline
In any case, even if I can't log to journald, what is the best way to rotate the log files in archlinux?
EDIT: Okay, duh, installed logrotate, got that working fine - so I guess the real issue here is: what is the preferred way to migrate legacy daemons to use journald, (e.g. processes which have log files traditionally)?
Last edited by ioquatix (2014-03-31 01:59:55)
Offline