Cron log monitoring helps track scheduled tasks run by cron to ensure they execute correctly and to detect errors or failures.
Click to reveal answer
beginner
Where is the default location of cron logs on most Linux systems?
Cron logs are usually found in /var/log/cron or /var/log/syslog depending on the Linux distribution.
Click to reveal answer
beginner
Which command shows the last 20 lines of the cron log file?
Use tail -n 20 /var/log/cron or tail -n 20 /var/log/syslog to view recent cron entries.
Click to reveal answer
intermediate
How can you filter cron log entries for a specific user?
Use grep username /var/log/cron to see cron jobs run by that user.
Click to reveal answer
intermediate
What is the role of rsyslog or syslog in cron logging?
rsyslog or syslog services collect and store cron job logs by capturing system messages and writing them to log files.
Click to reveal answer
Which file commonly contains cron logs on Ubuntu systems?
A/etc/crontab
B/home/cron.log
C/var/log/cron.log
D/var/log/syslog
✗ Incorrect
Ubuntu typically stores cron logs in /var/log/syslog along with other system messages.
What command shows real-time updates of cron logs?
Asystemctl status cron
Btail -f /var/log/cron
Ccronstatus
Dcat /etc/crontab
✗ Incorrect
tail -f shows live updates of the log file as new entries are added.
How do you check cron logs for errors?
Agrep ERROR /var/log/cron
Bls /var/log/cron
Ccron --check-errors
Dsystemctl restart cron
✗ Incorrect
Using grep to search for 'ERROR' in cron logs helps find error messages.
Which service is responsible for writing cron logs to files?
Arsyslog
Bcron itself
Csystemd
Dbash
✗ Incorrect
The rsyslog service collects system messages including cron logs and writes them to log files.
What does the command grep root /var/log/cron do?
ADeletes root's cron logs
BEdits the root user's cron jobs
CShows cron jobs run by the root user
DStarts the cron service as root
✗ Incorrect
It filters cron log entries to show only those related to the root user.
Explain how to monitor cron job execution using Linux log files.
Think about where logs are stored and how to read them.
You got /4 concepts.
Describe the steps to troubleshoot a failed cron job using log monitoring.
Focus on how logs help find what went wrong.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of monitoring cron logs on a Linux system?
easy
A. To install new cron jobs automatically
B. To check if scheduled tasks ran successfully
C. To delete old cron jobs from the system
D. To speed up the execution of cron jobs
Solution
Step 1: Understand cron job scheduling
Cron jobs are scheduled tasks that run automatically at set times.
Step 2: Purpose of cron log monitoring
Monitoring cron logs helps verify if these tasks ran as planned and if there were any errors.
Final Answer:
To check if scheduled tasks ran successfully -> Option B
Quick Check:
Cron logs track task success = A [OK]
Hint: Cron logs show task run status, not installation or deletion [OK]
Common Mistakes:
Confusing cron log monitoring with job installation
Thinking cron logs speed up tasks
Assuming cron logs delete jobs automatically
2. Which command correctly shows the last 10 lines of the cron log file located at /var/log/cron?
easy
A. tail /var/log/cron
B. head /var/log/cron
C. cat /var/log/cron | grep last 10
D. grep last /var/log/cron
Solution
Step 1: Understand the tail command
The tail command shows the last lines of a file, defaulting to 10 lines.
Step 2: Apply tail to cron log
Using tail /var/log/cron displays the last 10 lines of the cron log file.
Final Answer:
tail /var/log/cron -> Option A
Quick Check:
Last 10 lines = tail [OK]
Hint: Use tail to see recent log entries quickly [OK]
Common Mistakes:
Using head shows first lines, not last
Incorrect grep syntax for line count
Confusing grep with tail for last lines
3. What will be the output of this command if the cron log contains these lines:
Jun 10 10:00:01 server CRON[1234]: (root) CMD (backup.sh)
Jun 10 10:05:01 server CRON[1235]: (root) CMD (cleanup.sh)
Jun 10 10:10:01 server CRON[1236]: (root) CMD (backup.sh)
Command: grep backup.sh /var/log/cron
medium
A. Jun 10 10:00:01 server CRON[1234]: (root) CMD (backup.sh)
Jun 10 10:10:01 server CRON[1236]: (root) CMD (backup.sh)
B. Jun 10 10:05:01 server CRON[1235]: (root) CMD (cleanup.sh)
C. No output
D. Jun 10 10:00:01 server CRON[1234]: (root) CMD (backup.sh)
Solution
Step 1: Understand grep filtering
The grep backup.sh command filters lines containing 'backup.sh'.
Step 2: Identify matching lines in the log
Two lines contain 'backup.sh': the first and third lines.
Final Answer:
Both lines with backup.sh are shown -> Option A
Quick Check:
grep filters matching lines = C [OK]
Hint: grep shows all lines containing the search term [OK]
Common Mistakes:
Selecting only one matching line
Expecting output for unrelated terms
Thinking grep outputs no lines if multiple matches exist
4. You run grep CRON /var/log/cron | tail -5 but get no output, even though you know cron jobs ran recently. What is the most likely reason?
medium
A. Cron jobs do not write to /var/log/cron
B. The grep command syntax is incorrect
C. The tail command does not work with pipes
D. The cron log file is empty or missing
Solution
Step 1: Check command correctness
The command syntax is correct; grep filters lines with 'CRON', tail shows last 5 lines.
Step 2: Consider log file state
If no output appears, the log file may be empty or missing, so no lines match.
Final Answer:
The cron log file is empty or missing -> Option D
Quick Check:
No output usually means empty or missing file [OK]
Hint: No output often means empty or missing log file [OK]
Common Mistakes:
Blaming grep syntax when it is correct
Assuming tail can't work with pipes
Thinking cron never logs to /var/log/cron
5. You want to monitor cron logs in real-time to see new entries as they appear. Which command should you use?
hard
A. grep -r CRON /var/log/cron
B. cat /var/log/cron | head -n 10
C. tail -f /var/log/cron
D. less /var/log/cron
Solution
Step 1: Understand real-time log monitoring
Real-time monitoring means seeing new log lines as they are added.
Step 2: Use tail with follow option
tail -f keeps the file open and shows new lines live.
Final Answer:
tail -f /var/log/cron -> Option C
Quick Check:
tail -f shows live log updates [OK]
Hint: Use tail -f to watch logs live as they update [OK]
Common Mistakes:
Using grep -r which searches recursively, not live
Using head only shows start, not live updates
Using less does not auto-refresh new lines
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.