Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

current.log is getting too big #4

Open
e-i-k-e opened this issue Aug 11, 2022 · 15 comments
Open

current.log is getting too big #4

e-i-k-e opened this issue Aug 11, 2022 · 15 comments

Comments

@e-i-k-e
Copy link

e-i-k-e commented Aug 11, 2022

Hello,

I noticed that the "current.log" file has grown to over 300 Mb in the meantime. Is there a possibility to limit the log file or that it cleans itself?

image

@iz3man
Copy link

iz3man commented Sep 22, 2022

This seems to be an issues with all those scripts based on the same work by @fabian-lauer ?!
I got the issue with th goe-charger script.

This happens whenever something goes wrong an floods the log.
It seems there is no log-rotate or some kind of logfile size check and auto dumping.

This is a serious issue, as, as soon as the file is >2Gb it can't be addressed by 32bit venusos anymore.

@fabian-lauer
Copy link
Contributor

Ok - got it …. So we need a proper logging framework.
Any recommendations for python?

@iz3man
Copy link

iz3man commented Sep 22, 2022

Sorry. No idea. I just discovered the issue. :(

@fabian-lauer
Copy link
Contributor

Will try this one here after my vacation: https://www.blog.pythonlibrary.org/2014/02/11/python-how-to-create-rotating-logs/

currently no notebook in place 😎

@iz3man
Copy link

iz3man commented Sep 22, 2022

Nice. Yeah logrotate - no idea why it seems not to be inplemented in venusOS?!
Enjoy your vacation - Viel Spass noch! :)

@mascheihei
Copy link

I have rotatelog already integrated. Will make a fork and and this

@iz3man
Copy link

iz3man commented Sep 24, 2022

Great! Will you post a link to the fork? Why not just update the original version? I think it's benefical (if not mandatory) for every user, as a not noticed error can render the whole partition unusable and unwriteable as it's 100% full.

@mascheihei
Copy link

I have created a pull request for the original fork. viktOrm can merge the changes into his main. I saw your bugreport and changed it 3 days ago before installing on the Cerbo of my friend.
However: https://github.com/mascheihei/dbus-shelly-1pm-pvinverter

@e-i-k-e
Copy link
Author

e-i-k-e commented Dec 22, 2022

Is there a solution meanwhile?

My memory was full and VenusOS didn't run properly anymore because I had two log files with 2.2 and 3 GB each.

@pau1phi11ips
Copy link

@e-i-k-e just delete the logs files via SSH

@e-i-k-e
Copy link
Author

e-i-k-e commented Dec 22, 2022

@pau1phi11ips

Logical. But this does not permanently solve the problem.

@mascheihei
Copy link

mascheihei commented Dec 23, 2022

@e-i-k-e and @pau1phi11ips

I tried with a pull request but it seems vikt=rm is gone ... Therefore I removed my fork.

With these changes you will get rotating logfiles for 7 days. the older log-files will be deleted.

adjust the following:

in line 5 after import logging add

from logging.handlers import TimedRotatingFileHandler

in main after line 194 insert log rotate handler and change logging.basic... as below. Not sure why with posting the __ file __ is changing. Please use the same as in the original.
`
log_rotate_handler = TimedRotatingFileHandler("%s/current.log" % (os.path.dirname(os.path.realpath(file))),
when="d",
interval=1,
backupCount=7)

logging.basicConfig(format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.INFO,
handlers=[
logging.StreamHandler(),
log_rotate_handler
])
`

@vikt0rm
Copy link
Owner

vikt0rm commented Jul 5, 2023

Sorry for being absent for so long time, now I started again maintaining the code. Since I finally got my Multiplus 2 5000, battery and final PV installation these days.

Will add the rotating log to my implementation, that is very good idea! Thanks for the hint!

@ramack
Copy link
Contributor

ramack commented Jul 13, 2023

Isn't there a somehow "standard" approach for logging (which would also end up in /var/log and probably using the strange timestamping you need tai64n for? - I didn't search but this driver is not the first one, so I guess the victron guys did their job here and you could "simply" reuse it.

@mpvader
Copy link

mpvader commented May 31, 2024

Hello all, yes there is a standard approach within Venus OS, which I’d really prefer that everyone sticks to. I’ve explained it here:

henne49/dbus-opendtu#173

Todays current.log file approach is causing our users quite some headaches, and support issues sent to our distributors, and so forth.

Please help sort this sooner rather than later - thanks.

felix9191 added a commit to felix9191/dbus-shelly-1pm-pvinverter that referenced this issue Jul 6, 2024
Fix for vikt0rm#4 by implementing a size limit for current.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants