Answer the question
In order to leave comments, you need to log in
What can be done with the logs file?
Good afternoon. I looked at the site files on the hosting, the logs file occupies 158 megabytes, is it possible to somehow clean them without harming the site so that nothing changes on the site or the logs cannot be touched? Website on wordpress. Thank you.
And what is the logs file and why does it increase in size?
Answer the question
In order to leave comments, you need to log in
This is a file that stores records of events that occur. Almost every program has its own log file and there are also system log files. For example, a web server logs who, when and with what request addressed it, as well as errors that occurred. Naturally, the logs tend to grow. So that they do not fill all the free space, they must be trimmed periodically. The best way to do this is to set up logrotate .
These are site logs where visits and errors are recorded.
If you do not plan to fix them, you can overwrite their contents.> error.log
You can delete the contents of these files. The site doesn't need them. But if tomorrow it turns out that something happened and you need to find the reason, and you could find out by looking at the log, then you will regret that you just took it and deleted it.
Usually done so-called. log rotation - copying logs to a new file when a certain limit is reached. Well, for example, if 10 megabytes of logs have accumulated, then we copy them to the logname.log.1 file, and clear the current file. Once again accumulated - rename logname.log.1 to logname.log.2 and again copy the contents of the log to logname.log.1. At the same time, logs with numbers are often archived so that they take up less space. Well, to forget about the fact that the logs can clog your disk, some logname.log.10 is no longer rewritten to the next file, but deleted.
Usually, rotation is done automatically by the program (website, web server, DBMS) that writes these very logs, it only needs to be configured. But the program may not be able to rotate. Then you can write some bash script that will run cron every N hours and rotate the specified file.
In general, logs are a vast topic. There are cases when it is necessary to raise a separate machine, and even more than one, in order to collect logs from any software and display them in a convenient form.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question