P
P
Pegas123452021-06-30 12:27:10
linux
Pegas12345, 2021-06-30 12:27:10

LOGROTATE - not writing to a new file?

Good afternoon.

Faced here with such problem. There is a log file in which any infa is thrown off, type >> logfile.log. And there is logrotate, which was supposed to rotate this file. But he copies this log to a new one, with a date already, like logfile.log-2021-06-30, that original file (logfile.log) is reset to zero, and the data continues to be collected not from scratch in that original file, but in that has been copied.

If the service is running, as I understand it, you need to restart the services, if by the way it is http, etc., and the file starts recording from scratch. And if the record goes to my file not from any dib service. but just the output of some commands, the output of information is simple, with the redirection ">>" to this file, then there is nothing to reload.

How to solve the problem? Something to do with file descriptors, sort of, right? Tell me please.

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2021-06-30
@ky0

Show config rotate. According to the description, it seems that the file is not recreated, but renamed on the fly, while the file descriptor remains old, so the service continues to write to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question