Packages, services, and logs / Stage 12 of 13 · step 7 of 9
Set up log rotation
Not running
Starting
Situation
The myapp service appends a line to /var/log/myapp/app.log every two seconds. The log has no
rotation: the file is already large and keeps growing. It needs proper rotation with logrotate.
Task
- A rule sits in its own file,
/etc/logrotate.d/myapp, covers/var/log/myapp/app.logand parses in logrotate without errors. - Under this rule the log rotates daily, seven old files are kept, and old files are compressed.
- One rotation has already run: the log's old contents sit in an archive next to it.
- After the rotation the
myappservice keeps writing to/var/log/myapp/app.log. - Later rotations by this rule do not take the service's writes away from
app.logeither.
Constraints
- Do not change the
myappservice or its program,/usr/local/bin/myapp. - Do not delete the log's old contents.
The tools you need are already installed. There's no internet on this machine.
Lab goals
0 of 5-
The /etc/logrotate.d/myapp rule covers /var/log/myapp/app.log and parses without errors — not checked yet
-
Under the rule the log rotates daily, seven old files are kept and old files are compressed — not checked yet
-
Rotation has run — the log's old contents sit in an archive — not checked yet
-
After rotation the myapp service writes to /var/log/myapp/app.log — not checked yet
-
Later rotations by the rule do not take the service's writes away from app.log either — not checked yet
Hints
0 of 3 open · they open one at a time
Hint 1
Show the solution
after 3 failed checks