2

Currently, I redirect stdout/stderr to file nohup.out. This file becomes very big after running some time, is there log rotation feature for nodeos?

  • Good question. Mine is also growing like crazy for almost a month already :)) I know it will be started fresh on restart, but other then that... – Vasiliy Bondarenko Sep 14 '18 at 8:25
2

Log rotation is an operating system feature and there is no need to duplicate it in nodeos.

You also don't need to restart nodeos to rotate the log as suggested in the comments.

logrotate is the most widely used linux utility and probably already exists on the server. Setting it up is also fairly easy, add a config file with the instructions to logrotate, then call it periodically using cron.

An example logrotateNodeos.conf

/path/to/nodeos/logfile.log {
    size 100k
    copytruncate
    create 664 ubuntu ubuntu
    rotate 4
}

And running it with cron:

* * * * * /usr/sbin/logrotate -s /path/to/save/the/result/of/logrotate/logstatus.txt /path/to/nodeos/logfile/logrotateNodeos.conf

If this still doesn't work, verify the path to the logrotate command using:

which logrotate

No need to run it every minute as in the example above. This will rotate the log whenever it is above the specified size and keep 4 older log files.

You can also ask logrotate to compress the old log files for you to save more space.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.