# NGINX variables are replaced by launcher scripts by taking values from env at
# the time of running the container
NGX_LOG_DIR/*.log {
    daily
    rotate 20
    size=100M
    nodateext
    copytruncate
    compress
    compresscmd /usr/bin/gzip
    compressext .gz
    sharedscripts
    notifempty
    postrotate
      [ -f NGX_LOG_DIR/openresty.pid ] && touch NGX_LOG_DIR/logrotated
      chmod 664 NGX_LOG_DIR/logrotated
      chown NGX_USER_USERID:NGX_USER_USERGROUP NGX_LOG_DIR/logrotated
    endscript
    missingok
    su NGX_USER_USERID NGX_USER_USERGROUP
}
