Move logs to a Samba share?

Hello there
As the SD cards are not that good for lot of writes, I was wondering if it would be possible to propose an option to move le log files (/var/log/openhab2 or more) to a samba share ?
Today lot of boxes are providing the capability to add an external HD and make it available on the network, so it’d be very good
Thanks

That would make OpenHAB and possibly your IS dependent on another system and the network between them. That decreases simplicity and likely reliability.

As a UNIX expert I would not move the logs. The OS by design assumes the log directory is always accessible and writable.

Use ZRAM. It keeps active logs in RAM to mitigate SD wearout and rotates them to SD only once (or anywhere you tell it to), see last parameter in /etc/ztab.
You can mount some long term storage dir off a NAS but as @Bruce_Osborne currectly notes don’t move /var/log there, it creates dependencies you don’t want to have.

ok, I was going to try that, bu the setup doesn’t work from my raspi 4 :

$ apt-get install -y -q --no-install-recommends make libattr1-dev
Reading package lists…
Building dependency tree…
Reading state information…
libattr1-dev is already the newest version (1:2.4.48-4).
make is already the newest version (4.2.1-1.2).
The following packages were automatically installed and are no longer required:
rpi.gpio-common triggerhappy
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 25 not upgraded.
error: invalid key: protoc/l.version
fatal: remote-curl: fetch attempted without a local repo
error: invalid key: protoc/l.version
fatal: protocol error: bad line lenwth character: 1.5

/opt/openhabian/functions/zram.bash: line 38: cd: /opt/zram/overlayfs-tools: No such file or directory
error: Could not read 33434662e2d516a8a3aff059ddb21fffa03b3bd7
fatal: Failed to traverse parents of commit f4cab73437212d000de50701c25129f426054b82
error: Could not read 33434662e2d516a8a3aff059ddb21fffa03b3bd7
fatal: No tags can describe ‘0032b1ed2430a73b41ce975003e35d91fb4947b3’.
Try --always, or create some tags.
2020-07-02_13:16:45_CEST [openHABian] Checking for default openHABian username:password combination… FAILED
2020-07-02_13:16:47_CEST [openHABian] We hope you got what you came for! See you again soon :wink:

Just for completeness:
you may have a look to the manual of the syslog daemon of your system.
In case it is rsyslogd e.g.: https://www.rsyslog.com/doc/v8-stable/configuration/index.html
It describes which logs at which level will be stored in which file - filelocation.
Via a configuration file in /etc/ directory this is configurable.

It works with a fresh install so I’d guess you messed up your repo or apt config or cache.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.