Challenge - 5 Problems
Log Rotation Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Jenkins log rotation configuration effect
Given this Jenkins pipeline snippet for log rotation:
What is the effect on the build logs?
properties([ buildDiscarder(logRotator(numToKeepStr: '5', daysToKeepStr: '10')) ])
What is the effect on the build logs?
Attempts:
2 left
💡 Hint
Look at the parameters numToKeepStr and daysToKeepStr carefully.
✗ Incorrect
The logRotator with numToKeepStr: '5' keeps only the last 5 builds, and daysToKeepStr: '10' deletes logs older than 10 days.
🧠 Conceptual
intermediate1:30remaining
Purpose of Jenkins log rotation
Why is log rotation important in Jenkins?
Attempts:
2 left
💡 Hint
Think about what happens if logs keep growing without limit.
✗ Incorrect
Log rotation prevents disk space exhaustion by removing old build logs.
❓ Configuration
advanced2:30remaining
Correct Jenkinsfile snippet for log rotation
Which Jenkinsfile snippet correctly configures log rotation to keep 7 builds and logs for 14 days?
Attempts:
2 left
💡 Hint
Check the parameter names and their types carefully.
✗ Incorrect
The correct parameters are numToKeepStr and daysToKeepStr as strings.
❓ Troubleshoot
advanced2:30remaining
Jenkins log rotation not deleting old logs
You configured Jenkins with:
But old logs are not deleted after 5 days. What is the most likely cause?
properties([ buildDiscarder(logRotator(numToKeepStr: '3', daysToKeepStr: '5')) ])
But old logs are not deleted after 5 days. What is the most likely cause?
Attempts:
2 left
💡 Hint
Consider file system permissions for Jenkins.
✗ Incorrect
If Jenkins cannot delete files due to permission issues, log rotation will fail silently.
✅ Best Practice
expert3:00remaining
Best practice for managing Jenkins logs in large environments
In a large Jenkins environment with many builds daily, what is the best practice for managing logs to ensure performance and disk space?
Attempts:
2 left
💡 Hint
Think about automation and long-term storage.
✗ Incorrect
Combining log rotation with archiving important logs externally balances disk use and audit needs.