Logrotate, nginx and @EVENTS_LOGS_DIR@

My daily cron emails seem OK but after some days I got an error email from logrotate:

/etc/cron.daily/logrotate:
Redirecting to /bin/systemctl reload httpd.service
Redirecting to /bin/systemctl reload httpd.service
mv: cannot move ‘/opt/kaltura/log/kaltura_nginx_access.log-20160731.gz’ to ‘@EVENTS_LOGS_DIR@/www.xxx.de-kaltura_nginx_access.log-20160731-05.gz’: No such file or directory
Redirecting to /bin/systemctl reload kaltura-nginx.service

Most kaltura related files within /etc/logrotate.de/ are symlinks but the nginx file is a normal file with this content:

/var/log/nginx/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 kaltura kaltura
sharedscripts
postrotate
[ -f /var/run/nginx.pid ] && kill -USR1 cat /var/run/nginx.pid
endscript
su root kaltura
}
/opt/kaltura/log/kaltura_nginx_access.log {
rotate 7
daily
missingok
compress
dateext
notifempty
lastaction
mv /opt/kaltura/log/kaltura_nginx_access.log-/bin/date +%Y%m%d.gz @EVENTS_LOGS_DIR@/hostname-kaltura_nginx_access.log-/bin/date +%Y%m%d-%H.gz
service kaltura-nginx reload
endscript
su root kaltura
}

Within the folder /opt/kaltura/app/configurations/logrotate I can’t see any nginx related file. I would have expected a kaltura_nginx file with replaced @EVENTS_LOGS_DIR@ value and a symlink to it.

Hi,

@EVENTS_LOGS_DIR@ should be replaced in /opt/kaltura/dwh/.kettle/kettle.properties with the value /opt/kaltura/web/logs

This is done as part of the /opt/kaltura/bin/kaltura-base-config.sh if you’re using RPM or in /var/lib/dpkg/info/kaltura-base.postinst on deb.

You can do it manually if you’d like but I am somewhat concerned that if you’re missing this value, you might have additional place holders that were never replaced.

Best thing to do would probably be re-running the config scripts but if this is truly the only issue, you can try to manually replace this as a first step.

I replaced that string by hand. But I think that special file isn’t touched by kaltura-base-config. When I grep for nginx within that setup script I find no matches. And as I said it isn’t a symlink within the logrotate.d folder as all the other files. So I think that file might be handled differently.

I looked into kaltura-nginx-config.sh and there is that line:

sed -i “s#@LOG_DIR@#$LOG_DIR#” /etc/logrotate.d/nginx

Which doesn’t match the @EVENTS_LOGS_DIR@

Since kaltura-nginx can run separately from the full Kaltura platform and the @EVENTS_LOGS_DIR@ only pertains to Analytics, which is only available if you install the entire Kaltura server, you will not find any reference to it in kaltura-nginx-config.sh.

As I said, you will see references to it at kaltura-base-config.sh, which is the base script for install all Kaltura Server roles.
When operating on a full server ENV, you are suppose to install the kaltura-nginx package last, as explained here:
https://github.com/kaltura/platform-install-packages/blob/master/doc/rpm-cluster-deployment-instructions.md#nginx-vod-server

Hope that explains it,