Make rsyslog on Linux save WeeWX logs separate from system

37 views
Skip to first unread message

sali...@gmail.com

unread,
Dec 5, 2025, 12:59:43 PM (16 hours ago) Dec 5
to weewx-user
hello,
I followed the configuration to take log from wiki but I have an error when I restart rsyslog.service

[rsyslogd[6115]: error during config processing: omfile: creating parent directories for file  '/home/patrick/weewx-data/log/weewx.log' failed: Read-only file system [v8.2504>]

My install done with pip install.

(weewx-venv) RPi:~/weewx-data $ ls -ail
total 64
659581 drwxrwxrwx 10 patrick patrick  4096  5 déc.  17:53 .
  1669 drwxrwxrwx 18 patrick patrick  4096  5 déc.  14:11 ..
659975 drwxr-xr-x  2 patrick patrick  4096  5 déc.  18:55 archive
659917 drwxrwxr-x  3 patrick patrick  4096  5 déc.  13:57 bin
659841 drwxrwxr-x  8 patrick patrick  4096  5 déc.  13:52 examples
660548 drwxrwxrwx  2 patrick patrick  4096  5 déc.  17:53 log
659977 drwxrwxrwx  4 patrick patrick  4096  5 déc.  18:55 public_html
659969 drwxrwxr-x  2 patrick patrick  4096  5 déc.  13:57 scripts
659711 drwxrwxr-x  8 patrick patrick  4096  5 déc.  13:57 skins
659921 drwxrwxr-x 18 patrick patrick  4096  5 déc.  13:52 util
659971 -rw-rw-r--  1 patrick patrick 22882  5 déc.  16:41 weewx.conf

etc/rsyslog.d/weewx.conf:
[# Put messages from WeeWX into file(s) separate from the system log file

# If you want log messages from each application in a separate file,
# then uncomment the following two lines, and comment the weewx.log line.
#$template WEEWX_LOGFILE,"/home/patrick/weewx-data/log/%programname%.log"
#if $programname startswith 'wee' then ?WEEWX_LOGFILE

# Put log messages from all WeeWX applications into a single file
if $programname startswith 'wee' then /home/patrick/weewx-data/log/weewx.log

# Finish the WeeWX rules
if $programname startswith 'wee' then stop]

I don't see where is my error of configuration

Patrick



michael.k...@gmx.at

unread,
Dec 5, 2025, 1:18:27 PM (15 hours ago) Dec 5
to weewx-user
I use this stanza in weewx.conf for logging:

[Logging]
    version = 1
    disable_existing_loggers = False
   
    # Root logger
    [[root]]
        level = INFO
        handlers = rotate,    #console
   
    # Additional loggers would go in the following section. This is useful for tailoring logging
    # for individual modules.
    [[loggers]]
   
    # Definitions of possible logging destinations
    [[handlers]]
       
        # Log to a set of rotating files    
        [[[rotate]]]
            level = INFO
            formatter = verbose
            class = logging.handlers.RotatingFileHandler
            filename = /home/patrick/weewx-data/log/weewxd.log
            maxBytes = 10000000
            backupCount = 4


Note: the user you run WeeWX with has to have write access to /home/patrick/weewx-data/log

I don't know if syslog is even involved then, but if I have understood correctly what you are trying to achieve, something like this could do the trick. See https://weewx.com/docs/5.2/usersguide/monitoring/?h=logging#logging-on-macos which apparently isn't limited to mac OS.

salinois

unread,
Dec 5, 2025, 2:51:12 PM (14 hours ago) Dec 5
to weewx...@googlegroups.com
Hi Mickael,
 Regarding the section, I've already tested it and it works;
 but since I'm using a PIP installation with Venv, 
I followed that section for the installation because I also want to add logrotate later.

I don't understand why it says "failed read-only" when I've set permissions to 777 everywhere, even up to /home/patrick/weewx-data/log.

Patrick
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/803edf7f-c291-410a-abba-6a5033aef1b4n%40googlegroups.com.

salinois

unread,
Dec 5, 2025, 2:53:32 PM (14 hours ago) Dec 5
to weewx...@googlegroups.com

And the one indicated for macOS also works!!!

Le 05/12/2025 à 19:18, 'michael.k...@gmx.at' via weewx-user a écrit :

michael.k...@gmx.at

unread,
Dec 5, 2025, 3:08:46 PM (13 hours ago) Dec 5
to weewx-user
It works and everything is contained in the config. No external configs, no symlinking, nothing else to do. That's why I'm using this ever since I stumbled across it.

salinois

unread,
Dec 5, 2025, 4:57:39 PM (12 hours ago) Dec 5
to weewx...@googlegroups.com

Yes, I understand,

but I'd really like to try the other solution!

patrick

vince

unread,
Dec 5, 2025, 5:14:17 PM (11 hours ago) Dec 5
to weewx-user
Patrick:
  • Whether you are using 'pip' or 'dpkg' does not matter at all.  Weewx v5 runs as the user who the venv runs under (pip) or it runs as a generic user weewx (dpkg), neither of which is root.  You have to ensure that whatever directory you want to log to is writable by that user.
  • If you want to use rsyslogd (which I use, FWIW), then if you install the unaltered util/rsyslog.d/weewx file in to /etc/rsyslog.d (and restart rsyslogd), the default will log all your weewx log entries to /var/log/weewx/weewxd.log and it will all be in one place.  You'll need to add yourself to group 'adm' to be able to read those files without using sudo.  Also remember to also install the provided util/logrotate.d/weewx file to /etc/logrotate.d so that the logs rotate automatically.
  • If you want to log via rsyslog to someplace else, you'll need to edit those config files to point to wherever you want, and set permissions correctly so rsyslogd (which runs as user=root group=adm) has permissions to write, and so that logrotate also has permissions to rotate the logs automatically.   If you move things around, the onus is on you to make it all work as the system integrator.  If you take the defaults you don't need to worry that stuff.
There is 'nothing' special or even remotely weewx related in the permission issues you are seeing.  This is all very basic how *nix permissions work.

salinois

unread,
3:08 AM (1 hour ago) 3:08 AM
to weewx...@googlegroups.com

thanks Vince.

I will try your advice.

Patrick

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages