Complete the code to specify the log file path in the nginx configuration.
access_log [1];The access_log directive requires the full path to the log file, commonly /var/log/nginx/access.log.
Complete the command to reload nginx after log rotation.
sudo systemctl [1] nginxThe reload command tells nginx to reload its configuration and reopen log files without stopping the service.
Fix the error in the logrotate configuration snippet for nginx logs.
/var/log/nginx/*.log {
daily
missingok
rotate [1]
compress
delaycompress
notifempty
create 0640 www-data adm
sharedscripts
postrotate
/bin/systemctl reload nginx > /dev/null 2>&1 || true
endscript
}The rotate directive expects a number indicating how many rotated logs to keep, e.g., 7.
Fill both blanks to complete the logrotate postrotate script for nginx.
/var/log/nginx/*.log {
postrotate
[1] nginx [2] > /dev/null 2>&1 || true
endscript
}The invoke-rc.d command is used to call service scripts, and reload tells nginx to reload logs without downtime.
Fill all three blanks to create a dictionary comprehension that maps log file names to their sizes if size is greater than 0.
log_sizes = [1]: [2] for [1] in [3] if os.path.getsize([1]) > 0
This comprehension creates a dictionary where keys are log file names and values are their sizes, filtering only files larger than zero bytes.