fabian-lauer / dbus-shelly-3em-smartmeter

Integrate Shelly 3EM smart meter into Victron Energies Venus OS
124 stars 55 forks source link

Log goes too big #52

Open hipik634 opened 1 year ago

hipik634 commented 1 year ago

Hi, the current.log tends to gain all the free space on partition. Deleting from time to time solves that, but if you would clear it on boot, it will be better for all others. I can do it by cron, of course.

mawi42 commented 8 months ago

Config can also be used, setting e.g. LogLevel = ERROR and/or SignOfLifeLog to a high value

johnyhravy commented 3 months ago

Hello. I have the same memory filling problem.

This is what my config looks like. ini:

[DEFAULT] AccessType = OnPremise SignOfLifeLog = 5 GridMeterBalancing = 1 LogLevel=INFO

[ONPREMISE] Host=192.168.0.199 Username= Password=

Should I still edit it? And please advise how.

Here's an extract from Shelly's directory:

root@raspberrypi4:/data/dbus-shelly-3em-smartmeter# du du: ./current.log: Value too large for defined data type 220 ./img 84 ./docs 8 ./service/supervise 16 ./service 364 .

Can I request an order to erase the logs? Thank you very much.

mawi42 commented 3 months ago

Hi, yes, I would edit the file and as I wrote set e.g. LogLevel=ERROR I used simple the vi editor to edit the file which is available on the device. And I also just removed the log file.

Hope this helps

johnyhravy commented 3 months ago

Thank you for the quick reply. Can I ask for the exact specification of that command to delete the file? I'm not a complete expert. Thank you.

hipik634 commented 3 months ago

i used crontab as follows before that 0 0 0 rm /data/dbus-shelly-3em-smartmeter/current.log && /bin/bash /data/dbus-shelly-3em-smartmeter/restart.sh but each update removed it. You can use it to manually delete the log (it cannot be done while running) So just run this and you should be fine "rm /data/dbus-shelly-3em-smartmeter/current.log && /bin/bash /data/dbus-shelly-3em-smartmeter/restart.sh"

johnyhravy commented 3 months ago

Thank you for answer. Unfortunately it doesn't help me. The answer in Putty is:

root@raspberrypi4:~# rm /data/dbus-shelly-3em-smartmeter/current.log && /bin/bash /data/dbus-shelly-3em-smartmeter/restart.sh rm: can't stat '/data/dbus-shelly-3em-smartmeter/current.log': Value too large for defined data type

Please clarify what I am doing wrong. Thank you.

hipik634 commented 3 months ago

It's probably in different folder, just do "du / - h" to look for the biggest folders

Dne čt 16. 5. 2024 15:59 uživatel Johny H @.***> napsal:

Thank you for answer. Unfortunately it doesn't help me. The answer in Putty is:

@.***:~# rm /data/dbus-shelly-3em-smartmeter/current.log && /bin/bash /data/dbus-shelly-3em-smartmeter/restart.sh rm: can't stat '/data/dbus-shelly-3em-smartmeter/current.log': Value too large for defined data type

Please clarify what I am doing wrong. Thank you.

— Reply to this email directly, view it on GitHub https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter/issues/52#issuecomment-2115330107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKNJC6OIOASFUONJI7MOJDZCS3TJAVCNFSM6AAAAAA2Z53W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGMZTAMJQG4 . You are receiving this because you authored the thread.Message ID: @.***>

johnyhravy commented 3 months ago

The command "du / - h" was very long and at the end this. du: -: No such file or directory du: h: No such file or directory

Then I used "du -d 3 /data | sort -nr" root@raspberrypi4:~# du -d 3 /data | sort -nr du: /data/dbus-shelly-3em-smartmeter/current.log: Value too large for defined data type

Thank you very much for your kind help. Can you think of anything else?

hipik634 commented 3 months ago

if you do cd /data/dbus-shelly-3em-smartmeter/current.log ls -l what is the output? also feel free to use chatgpt for the support, works well with basics ...

čt 16. 5. 2024 v 17:03 odesílatel Johny H @.***> napsal:

The command "du / - h" was very long and at the end this. du: -: No such file or directory du: h: No such file or directory

Then I used "du -d 3 /data | sort -nr" @.***:~# du -d 3 /data | sort -nr du: /data/dbus-shelly-3em-smartmeter/current.log: Value too large for defined data type

Thank you very much for your kind help. Can you think of anything else?

— Reply to this email directly, view it on GitHub https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter/issues/52#issuecomment-2115497065, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKNJC4DKRDVEBW4HL3OI2TZCTDEPAVCNFSM6AAAAAA2Z53W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGQ4TOMBWGU . You are receiving this because you authored the thread.Message ID: @.***>

johnyhravy commented 3 months ago

root@raspberrypi4:~# cd /data/dbus-shelly-3em-smartmeter/current.log -sh: cd: /data/dbus-shelly-3em-smartmeter/current.log: Not a directory root@raspberrypi4:~# ls -l -rw-r--r-- 1 root root 277 Sep 29 2022 installrelease.sh -rw-r--r-- 1 root root 277 Oct 14 2022 installrelease.sh.1 -rw-r--r-- 1 root root 277 Nov 19 2022 installrelease.sh.2 -rw-r--r-- 1 root root 0 Mar 29 14:29 main.zip -rw------- 1 root root 0 Feb 15 15:28 nano.save -rw------- 1 root root 0 Feb 15 15:28 nano.save.1 -rw-r--r-- 1 root root 74135 Nov 27 2022 venus-data.tar.gz

hipik634 commented 3 months ago

sorry, there was a typo cd /data/dbus-shelly-3em-smartmeter/ and then ls -l you have to find the folder where it is installed into use cd and tab-key to go to the desired folder.

should look like this

@.:~# cd /data/dbus-shelly-3em-smartmeter/ @.:/data/dbus-shelly-3em-smartmeter# ls README.md current.log docs install.sh service config.ini dbus-shelly-3em-smartmeter.py img restart.sh uninstall.sh @.***:~# rm /data/dbus-shelly-3em-smartmeter/current.log && /bin/bash /data/dbus-shelly-3em-smartmeter/restart.shcd ^C

čt 16. 5. 2024 v 17:22 odesílatel Jan Mašek @.***> napsal:

if you do cd /data/dbus-shelly-3em-smartmeter/current.log ls -l what is the output? also feel free to use chatgpt for the support, works well with basics ...

čt 16. 5. 2024 v 17:03 odesílatel Johny H @.***> napsal:

The command "du / - h" was very long and at the end this. du: -: No such file or directory du: h: No such file or directory

Then I used "du -d 3 /data | sort -nr" @.***:~# du -d 3 /data | sort -nr du: /data/dbus-shelly-3em-smartmeter/current.log: Value too large for defined data type

Thank you very much for your kind help. Can you think of anything else?

— Reply to this email directly, view it on GitHub https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter/issues/52#issuecomment-2115497065, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKNJC4DKRDVEBW4HL3OI2TZCTDEPAVCNFSM6AAAAAA2Z53W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGQ4TOMBWGU . You are receiving this because you authored the thread.Message ID: @.***>

johnyhravy commented 3 months ago

root@raspberrypi4:~# cd /data/dbus-shelly-3em-smartmeter/ root@raspberrypi4:/data/dbus-shelly-3em-smartmeter# ls -l ls: ./current.log: Value too large for defined data type -rw-r--r-- 1 root root 4284 Jan 7 2023 README.md -rw-r--r-- 1 root root 142 May 16 05:00 config.ini -rw-r--r-- 1 root root 12077 Jan 7 2023 dbus-shelly-3em-smartmeter.py drwxrwxrwx 2 root root 4096 Jan 7 2023 docs drwxrwxrwx 2 root root 4096 Jan 7 2023 img -rwxr-xr-x 1 root root 866 Jan 7 2023 install.sh -rwxr--r-- 1 root root 160 Jan 7 2023 restart.sh drwxrwxrwx 3 root root 4096 Mar 5 19:07 service -rwxr--r-- 1 root root 176 Jan 7 2023 uninstall.sh

hipik634 commented 3 months ago

rm -rf current.log ./restart.sh

čt 16. 5. 2024 v 18:15 odesílatel Johny H @.***> napsal:

@.:~# cd /data/dbus-shelly-3em-smartmeter/ @.:/data/dbus-shelly-3em-smartmeter# ls -l ls: ./current.log: Value too large for defined data type -rw-r--r-- 1 root root 4284 Jan 7 2023 README.md -rw-r--r-- 1 root root 142 May 16 05:00 config.ini -rw-r--r-- 1 root root 12077 Jan 7 2023 dbus-shelly-3em-smartmeter.py drwxrwxrwx 2 root root 4096 Jan 7 2023 docs drwxrwxrwx 2 root root 4096 Jan 7 2023 img -rwxr-xr-x 1 root root 866 Jan 7 2023 install.sh -rwxr--r-- 1 root root 160 Jan 7 2023 restart.sh drwxrwxrwx 3 root root 4096 Mar 5 19:07 service -rwxr--r-- 1 root root 176 Jan 7 2023 uninstall.sh

— Reply to this email directly, view it on GitHub https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter/issues/52#issuecomment-2115660050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKNJC7PLE7CMAQJM635TMTZCTLS3AVCNFSM6AAAAAA2Z53W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGY3DAMBVGA . You are receiving this because you authored the thread.Message ID: @.***>

johnyhravy commented 3 months ago

root@raspberrypi4:/data/dbus-shelly-3em-smartmeter# rm -rf current.log rm: can't stat 'current.log': Value too large for defined data type root@raspberrypi4:/data/dbus-shelly-3em-smartmeter# ./restart.sh

hipik634 commented 3 months ago

first I would reboot it, try again; if it would not work I would do it according to chatgpt:

1.

Use the ls command with the -i option to get the inode number of the file:

bash Zkopírovat kód ls -i current.log

This will output the inode number along with the filename. 2.

Once you have the inode number, you can use the find command to delete the file using the inode number:

bash Zkopírovat kód find . -inum [inode_number] -exec rm {} \;

čt 16. 5. 2024 v 18:21 odesílatel Johny H @.***> napsal:

@.:/data/dbus-shelly-3em-smartmeter# rm -rf current.log rm: can't stat 'current.log': Value too large for defined data type @.:/data/dbus-shelly-3em-smartmeter# ./restart.sh

— Reply to this email directly, view it on GitHub https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter/issues/52#issuecomment-2115673326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKNJC7HUIBPS3K66TGECD3ZCTMI7AVCNFSM6AAAAAA2Z53W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGY3TGMZSGY . You are receiving this because you authored the thread.Message ID: @.***>

johnyhravy commented 3 months ago

But the current.log file doesn't have that code, so I can't use it...

root@raspberrypi4:/data/dbus-shelly-3em-smartmeter# ls -i ls: ./current.log: Value too large for defined data type 391692 README.md 391703 install.sh 391693 config.ini 391704 restart.sh 391694 dbus-shelly-3em-smartmeter.py 391705 service 391695 docs 391707 uninstall.sh 391698 img

hipik634 commented 3 months ago

Run fsck maybe it will fix it, i can't help you else

Dne čt 16. 5. 2024 18:57 uživatel Johny H @.***> napsal:

But the current.log file doesn't have that code, so I can't use it...

@.***:/data/dbus-shelly-3em-smartmeter# ls -i ls: ./current.log: Value too large for defined data type 391692 README.md 391703 install.sh 391693 config.ini 391704 restart.sh 391694 dbus-shelly-3em-smartmeter.py 391705 service 391695 docs 391707 uninstall.sh 391698 img

— Reply to this email directly, view it on GitHub https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter/issues/52#issuecomment-2115766191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKNJC722LHN42QYQ7UJ7ZDZCTQQZAVCNFSM6AAAAAA2Z53W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVG43DMMJZGE . You are receiving this because you authored the thread.Message ID: @.***>

johnyhravy commented 3 months ago

root@raspberrypi4:/data/dbus-shelly-3em-smartmeter# fsck fsck from util-linux 2.35.1 e2fsck 1.45.7 (28-Jan-2021) /dev/mmcblk0p4 is mounted. e2fsck: Cannot continue, aborting.

Thank you very much for your patience and detailed instructions. I'll try to get some help on how to clear the log so I don't have to uninstall Shelly. After these attempts, it seems that even the uninstall would fail due to the inaccessibility of the log. In addition, I also use HomeAssistant and I really don't want to redo anything with my knowledge :)

hipik634 commented 3 months ago

You will probably need to take the sd card to a different machine to be able to make the changes necessary without running os on it. Really, try chatgpt.

Dne čt 16. 5. 2024 21:30 uživatel Johny H @.***> napsal:

@.***:/data/dbus-shelly-3em-smartmeter# fsck fsck from util-linux 2.35.1 e2fsck 1.45.7 (28-Jan-2021) /dev/mmcblk0p4 is mounted. e2fsck: Cannot continue, aborting.

Thank you very much for your patience and detailed instructions. I'll try to get some help on how to clear the log so I don't have to uninstall Shelly. After these attempts, it seems that even the uninstall would fail due to the inaccessibility of the log. In addition, I also use HomeAssistant and I really don't want to redo anything with my knowledge :)

— Reply to this email directly, view it on GitHub https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter/issues/52#issuecomment-2116031049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKNJC7W2JCEHHLI7XOTI7DZCUCMFAVCNFSM6AAAAAA2Z53W6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJWGAZTCMBUHE . You are receiving this because you authored the thread.Message ID: @.***>

Kotty666 commented 2 months ago

@johnyhravy try

# echo > /data/dbus-shelly-3em-smartmeter/current.log
# /bin/bash /data/dbus-shelly-3em-smartmeter/restart.sh

this should work. I've also fixed the problem with growing log files and waiting that the code will be merged ( PR #71 )

johnyhravy commented 2 months ago

Thank you very much for your answer. About 2 weeks ago, with the help of experienced advisors, I managed to clear the entire memory. I don't even know how it happened, but 2 days after entering various commands, the memory was OK. Thanks everyone for the advice.