Cisco
350-201(NEW-127Q) · Question #25
350-201(NEW-127Q) Question #25: Real Exam Question with Answer & Explanation
Sign in or unlock 350-201(NEW-127Q) to reveal the answer and full explanation for question #25. The question stem and answer options stay visible for context.
Security Operations and Automation
Question
Refer to the exhibit. A SOC engineer attempts to automate a recurring log analysis task. Which modification in the Python code must be made to the provided script to automatically save the output to a file instead of displaying it? (Exhibit: for log in logs: if 'error' in log: print(log))
Options
- AAdd output redirection to save the results to a file: for log in logs: if 'error' in log: with open('output.txt', 'a') as f: f.write(log + '\n')
- BInclude a copy command to store logs in a different directory before analysis: cp logs /backup
- CStore the output in a file: logs.each { |log| File.open('output.txt', 'a') { |f| f.write(log + "\n") } if log.include?('error') }
- DAdjust the print statement to display the results in the console: for log in logs: if 'error' in log: print('ERROR: ' + log)
Unlock 350-201(NEW-127Q) to see the answer
You've previewed enough free 350-201(NEW-127Q) questions. Unlock 350-201(NEW-127Q) for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Python file I/O#Log analysis automation#Output redirection#SOC scripting