This is a simple bash script that extracts response codes from an Nginx access log for a given day.
Before running the script, make sure to set the log_file variable to the path of your Nginx access log file.
To run the script:
./extract_response_codes.shThe script performs the following steps:
- Checks if the specified log file exists.
- Extracts the access log entries for the current date into a new file named with the current date.
- Extracts the response codes from the new access log file and sorts them by frequency.
- Displays the sorted response codes.
- Deletes the new access log file.
- Nginx
- Bash