Module 4 challenge: Working with log files :Using Python to Interact with the Operating System (Google IT Automation with Python Professional Certificate) Answers 2025
1. Connecting to VM via SSH and PuTTY
✔️ Downloading the PPK key file from the Qwiklabs Start Lab page
✔️ Entering the username and external IP address in the Host Name (or IP address) box
✔️ Opening the PuTTY Secure Shell (SSH) client
❌ Entering a password for authentication
2. Primary purpose of sys module
❌ Performing system-level operations like managing files and directories
❌ Creating GUIs
✔️ Provides functions and variables to interact with the Python interpreter and the runtime environment
❌ Mathematical computations
3. Role of error_search function
✔️ To create and search for RegEx patterns based on user input to identify errors in the log file
❌ Split log file
❌ Encrypt data
❌ Compile a fixed RegEx
4. Purpose of sys.exit(0)
❌ Display error message and halt
❌ Pause and wait for input
❌ Forcibly terminate
✔️ Indicates successful termination of the script
5. Role of if __name__ == "__main__": block
❌ Defines custom functions
❌ Specifies author info
✔️ Serves as the main entry point of the script; execution begins here when run as main program
❌ Handles syntax errors
6. Information in errors_found.log
❌ Configuration settings
✔️ Specific error logs matching user-defined search criteria
❌ List of users
❌ System performance metrics
7. Function that takes errors as formal parameter
✔️ file_output
❌ error_search
❌ Both
❌ returned_errors
8. How find_error.py processes fishy.log
❌ Automatically fixes syntax errors
✔️ Searches fishy.log for user-specified errors and generates errors_found.log
❌ Translates contents
❌ Compresses file
9. Primary function of os module
❌ Machine learning and data analysis
❌ GUI creation
✔️ Managing file paths and directory structures
❌ Exclusively for web development
10. Finding network connection failures in fishy.log
✔️ Modify user input line to specifically ask for “network connection failure” errors, then process fishy.log
❌ Change error_patterns list to only “network” and “failure”
❌ Edit file_output to filter
❌ Rewrite Regex to match only “network”
📌 Summary Table
| Q# | Correct Answer(s) |
|---|---|
| 1 | Download PPK key, Enter username/IP, Open PuTTY ✔️ |
| 2 | Interact with Python interpreter ✔️ |
| 3 | Create & search RegEx for errors ✔️ |
| 4 | Indicate successful termination ✔️ |
| 5 | Main entry point when script run ✔️ |
| 6 | Specific error logs matching criteria ✔️ |
| 7 | file_output ✔️ |
| 8 | Search fishy.log & create errors_found.log ✔️ |
| 9 | Manage file paths & directories ✔️ |
| 10 | Modify user input to search for “network connection failure” ✔️ |