[systemd-devel] journald-remote problem

a a at ooxo.tk
Thu Apr 23 06:15:09 PDT 2015


Excerpts from Eric's message of 2015-04-22 21:14:56 +0900:
> Hi, I'm trying to sync my vps log to laptop. They are connected with
> openvpn.
> 
> Both laptop and vps are,
> 
> - Arch Linux
> - systemd 219-5
> 
> - vps: 10.8.0.1
> - laptop: 10.8.0.6
> 
> It is already secured by openvpn tunnel. So I tried with normal http
> settings. Services are launched successfully. There is nothing happening
> in journal. Also there is nothing in /var/log/journal/remote/ .
> 
> Also I tried example from man page.
> 
> ~~~
> $ ll /tmp/jjj
> -rw-r--r-- 1 a a 0 Apr 22 15:54 /tmp/jjj
> $ journalctl -o export | /usr/lib/systemd/systemd-journal-remote -o
> /tmp/jjj -
> Received 0 descriptors
> Using standard input as source.
> Failed to open output journal /tmp/jjj: Invalid argument
> Failed to get writer for source stdin: Invalid argument
> Failed to create source for fd:0 (stdin): Invalid argument
> ~~~
> 
> Am I doing right? I attach config and service file.
> 
> Thanks.
> 
> # laptop ; 10.8.0.6
> # /etc/systemd/system/systemd-journal-remote.socket
> 
> [Unit]
> Description=Journal Remote Sink Socket
> 
> [Socket]
> ListenStream=10.8.0.6:19532
> 
> [Install]
> WantedBy=sockets.target
> 
> # laptop ; 10.8.0.6
> # /etc/systemd/system/systemd-journal-remote.service
> 
> [Unit]
> Description=Journal Remote Sink Service
> Requires=systemd-journal-remote.socket
> 
> [Service]
> ExecStart=/usr/lib/systemd/systemd-journal-remote \
>           --listen-http=-3 \
>           --output=/var/log/journal/remote/
> User=systemd-journal-remote
> Group=systemd-journal-remote
> PrivateTmp=yes
> PrivateDevices=yes
> PrivateNetwork=yes
> WatchdogSec=10min
> 
> [Install]
> Also=systemd-journal-remote.socket
> 
> # vps ; 10.8.0.1
> # /usr/lib/systemd/system/systemd-journal-upload.service
> 
> [Unit]
> Description=Journal Remote Upload Service
> After=network.target
> 
> [Service]
> ExecStart=/usr/lib/systemd/systemd-journal-upload \
>           --save-state
> User=systemd-journal-upload
> PrivateTmp=yes
> PrivateDevices=yes
> WatchdogSec=20min
> 
> [Install]
> WantedBy=multi-user.target
> 
> # vps ; 10.8.0.1
> # /etc/systemd/journal-remote.conf
> 
> [Upload]
> URL=http://10.8.0.6

It's working now. It was quite long journey.

The problem was journald-upload process couldn't read journal file. I
had run with strace and it repeatedly said like this,

(open /var/log/.../system.journal, PERMISSION DENIED).

$ ls -l /var/log/journal/.../system.journal
-rw-r-----+ 1 root systemd-journal 8388608 Apr 23 21:08
/var/log/journal/87dd383134bc4070950aa51ab6cbd793/system.journal

I added systemd-journal-upload user to systemd-journal group then it's
working.

Next step would be automatically trigger syncing when vpn connection
ready.

1. Power on laptop
2. openvpn service up
3. journal-remote up
4. send notification to vps
5. journal-upload up (vps)
6. syncing until vpn disconnect

If I could just retry journald-upload periodically, It would be good
enough.

Any advice would be appreciated.

Thanks.


More information about the systemd-devel mailing list