All right.
So first thing, we need to make sure
that the journal is persistent.
Well, that's easy, mkdir var log journal.
So next, we need systemctl restart systemd journal flush.
If you don't do that, you need to wait until the next reboot.
And that is just a little bit less convenient.
So better don't do that.
Now, we needed to create an entry in rsyslog
that writes all messages with the severity of error
or higher to var log error.
So let's go into etc rsyslog.conf.
And there, I would advise you go down to the rules
and you use something that looks more or less
like what you want to do.
So what are we talking about?
All messages with the severity of error or higher.
So that would be star dot r for error.
And then, we are going to define where we want to write them.
We want to write them to var log error.
And next, systemctl restart rsyslog.
And then, can we check that?
Well, logger minus pr error message is what you could do.
And then, we check on var log error.
And as you can see, my error message has been logged.
Oh, and that is kind of funny.
Some other messages have been logged as well.
So this is what we needed.
And it seems to be working all right.
Then, we need to make sure that var log error is
rotated on a monthly basis.
And the last 12 logs are kept before they are rotated out.
So let's go to etc.logrotate.d, where
I would suggest that you have a look at some of these examples.
And I'm going to get on a random one, the triple SD,
for instance.
And that looks OK.
And I'm going to copy this triple SD to error.
And then, I can edit the error file,
where I'm going to check that we want the var log
error to be rotated.
And we want it to be rotated on a monthly basis.
And there's a couple of parameters
that nobody is asking for.
And I would say, if nobody is asking for them,
then remove them.
And that means that we can be pretty compact here
and just have a rotation that has two lines in total.
Everything that you would put in addition
increases the risk that you make an error on the exam.
So better don't do that.
And this is how we set up all of the logging-related questions
in this end-of-lesson lab.