Hello Varnish Community,

I'm running an openSUSE 42.2 server with varnish 5.1.2

My problem is that varnishlog.service always fails starting after a system reboot.

cx40:~ # systemctl status varnishlog.service
● varnishlog.service - Varnish log generator
Loaded: loaded (/etc/systemd/system/varnishlog.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2017-08-09 16:30:47 CEST; 1min 7s ago Process: 1162 ExecStart=/usr/sbin/varnishncsa $VARNISHLOG_PARAMS -P /var/run/varnishlog.pid (code=exited, status=1/FAILURE)
 Main PID: 1162 (code=exited, status=1/FAILURE)

Aug 09 16:30:42 cx40 systemd[1]: Started Varnish log generator.
Aug 09 16:30:42 cx40 varnishncsa[1162]: Cannot open log - retrying for 5 seconds Aug 09 16:30:47 cx40 varnishncsa[1162]: Abandoned VSM file (Varnish not running?) /var/cache/varnish/cx40/_.vsm Aug 09 16:30:47 cx40 systemd[1]: varnishlog.service: Main process exited, code=exited, status=1/FAILURE Aug 09 16:30:47 cx40 systemd[1]: varnishlog.service: Unit entered failed state. Aug 09 16:30:47 cx40 systemd[1]: varnishlog.service: Failed with result 'exit-code'.

If I look at the varnish.service it is reported running

cx40:~ # systemctl status varnish.service
● varnish.service - Varnish HTTP accelerator/reverse proxy
Loaded: loaded (/usr/lib/systemd/system/varnish.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2017-08-09 16:30:48 CEST; 1min 41s ago
 Main PID: 1579 (varnishd)
    Tasks: 218 (limit: 512)
   CGroup: /system.slice/varnish.service
├─1579 /usr/sbin/varnishd -j unix,user=varnish -f /etc/varnish/main.vcl -a :80 -T localhost:6082 -s default=malloc,2G -s static=file,/var/cache/varnish,5G -P /var/run/varnishd.pid -F └─1672 /usr/sbin/varnishd -j unix,user=varnish -f /etc/varnish/main.vcl -a :80 -T localhost:6082 -s default=malloc,2G -s static=file,/var/cache/varnish,5G -P /var/run/varnishd.pid -F

Aug 09 16:30:48 cx40 systemd[1]: Started Varnish HTTP accelerator/reverse proxy. Aug 09 16:30:49 cx40 varnishd[1579]: Platform: Linux,4.4.79-18.23-default,x86_64,-junix,-smalloc,-sfile,-smalloc,-hcritbit Aug 09 16:30:49 cx40 varnishd[1579]: Debug: Platform: Linux,4.4.79-18.23-default,x86_64,-junix,-smalloc,-sfile,-smalloc,-hcritbit
Aug 09 16:30:49 cx40 varnishd[1579]: Child (1672) Started
Aug 09 16:30:49 cx40 varnishd[1579]: Debug: Child (1672) Started
Aug 09 16:30:49 cx40 varnishd[1579]: Child (1672) said Child starts
Aug 09 16:30:49 cx40 varnishd[1579]: Child (1672) said SMF.static mmap'ed 5368709120 bytes of 5368709120
Aug 09 16:30:49 cx40 varnishd[1579]: Info: Child (1672) said Child starts
Aug 09 16:30:49 cx40 varnishd[1579]: Info: Child (1672) said SMF.static mmap'ed 5368709120 bytes of 5368709120

If I start the varnishlog.service manually there's no problem at all

cx40:~ # systemctl start varnishlog.service
cx40:~ # systemctl status varnishlog.service
● varnishlog.service - Varnish log generator
Loaded: loaded (/etc/systemd/system/varnishlog.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-08-09 16:32:53 CEST; 4s ago
 Main PID: 3439 (varnishncsa)
    Tasks: 1 (limit: 512)
   CGroup: /system.slice/varnishlog.service
└─3439 /usr/sbin/varnishncsa -f /etc/varnish/varnishncsa-log-format-string -a -w /var/log/varnish/varnish.log -P /var/run/varnishlog.pid

Aug 09 16:32:53 cx40 systemd[1]: Started Varnish log generator.

For me it looks like that varnishlog.service is waiting for varnish.service to start and the varnish.service seems to take a bit long to start up? Is there a systemd service option to wait for a few seconds before starting varnishlog.service

something like a delayed start of the service?

I also override the default varnishlog.service in /usr/lib/systemd/system/varnishlog.service

with my own version in /etc/systemd/system/varnishlog.service

I do this because I need the [service] option WorkingDirectory

/etc/systemd/system/varnishlog.service

[Unit]
Description=Varnish log generator
Requires=varnish.service
#After= is not required

[Service]
WorkingDirectory=/var/log/varnish
EnvironmentFile=/etc/sysconfig/varnish
PIDFile=/var/run/varnishlog.pid
ExecStart=/usr/sbin/varnishncsa $VARNISHLOG_PARAMS -P /var/run/varnishlog.pid

[Install]
WantedBy=multi-user.target

The $VARNISHLOG_PARAMS are defined in /etc/sysconfig/varnish

VARNISHLOG_PARAMS="-f /etc/varnish/varnishncsa-log-format-string -a -w /var/log/varnish/varnish.log"

and the format string is defined in /etc/varnish/varnishncsa-log-format-string

%{VCL_Log:myhost}x %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"

All is working fine, except varnishlog.service won't properly start after a system reboot ;)

Any help is more than welcome ...

Thanks, greetings & best wishes
Becki


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to