0
0
Nginxdevops~10 mins

Why logging tracks server behavior in Nginx - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable access logging in nginx.

Nginx
access_log [1];
Drag options to blanks, or click blank then click option'
A/var/log/nginx/access.log
B/var/log/nginx/error.log
C/etc/nginx/nginx.conf
D/usr/share/nginx/html
Attempts:
3 left
💡 Hint
Common Mistakes
Using the error log path instead of access log path
Using configuration file path instead of log file path
2fill in blank
medium

Complete the code to set the log format to 'combined' in nginx.

Nginx
log_format main [1];
Drag options to blanks, or click blank then click option'
A"combined log"
Bcombined
C"combined"
D"default"
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect or misspelled format names
Omitting quotes around the format string
3fill in blank
hard

Fix the error in the nginx configuration to log errors to the correct file.

Nginx
error_log [1] warn;
Drag options to blanks, or click blank then click option'
A/var/log/nginx/error.log
B/var/log/nginx/access.log
C/etc/nginx/error.log
D/usr/share/nginx/error.log
Attempts:
3 left
💡 Hint
Common Mistakes
Using access log path for error logs
Using incorrect directory paths
4fill in blank
hard

Fill both blanks to configure nginx to log access using the 'main' format to the correct file.

Nginx
access_log [1] [2];
Drag options to blanks, or click blank then click option'
A/var/log/nginx/access.log
Bmain
Cerror
D/var/log/nginx/error.log
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping file path and format
Using error log path for access logs
5fill in blank
hard

Fill all three blanks to create a custom log format named 'detailed' that logs client IP, request method, and status code.

Nginx
log_format detailed '[1] [2] [3]';
Drag options to blanks, or click blank then click option'
A$remote_addr
B$request_method
C$status
D$host
Attempts:
3 left
💡 Hint
Common Mistakes
Using $host instead of $remote_addr for IP
Mixing variable order