0
0
Nginxdevops~5 mins

Access log configuration in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the access_log directive in nginx?
The access_log directive in nginx is used to specify the file where nginx will record details about each client request, such as IP address, request time, and response status.
Click to reveal answer
beginner
How do you disable access logging in an nginx server block?
You can disable access logging by setting access_log off; inside the server or location block.
Click to reveal answer
intermediate
What is the default format used by nginx for access logs?
The default format is called combined, which includes client IP, timestamp, request line, status code, bytes sent, referrer, and user agent.
Click to reveal answer
intermediate
How can you create a custom log format in nginx?
Use the log_format directive to define a custom format with variables, then reference it in the access_log directive.
Click to reveal answer
beginner
Where is the access log file typically located in a default nginx installation?
It is usually located at /var/log/nginx/access.log.
Click to reveal answer
Which directive in nginx controls where access logs are saved?
Aserver_log
Berror_log
Caccess_log
Dlog_format
How do you turn off access logging in nginx?
Aaccess_log off;
Blog_format off;
Cdisable_access_log;
Derror_log off;
What does the default nginx access log format include?
AOnly error messages
BOnly client IP and status code
COnly request method and URL
DClient IP, timestamp, request, status, bytes, referrer, user agent
Which directive allows defining a custom log format in nginx?
Alog_format
Baccess_log
Ccustom_log
Dformat_log
Where is the default nginx access log file usually stored?
A/etc/nginx/access.log
B/var/log/nginx/access.log
C/usr/local/nginx/logs/access.log
D/home/nginx/access.log
Explain how to configure a custom access log format in nginx and apply it.
Think about defining format first, then using it.
You got /3 concepts.
    Describe how to disable access logging for a specific server block in nginx.
    Focus on the access_log directive.
    You got /2 concepts.