From ef96a368f3c39971e93f38809cafbdc6b8c17b05 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 7 Jan 2023 00:20:05 +0100 Subject: [PATCH] ajout journald-remote --- journald-remote/Vagrantfile | 39 +++++++++++++++++++++++++++++++++ journald-remote/journald-rcv.sh | 18 +++++++++++++++ journald-remote/journald-snd.sh | 9 ++++++++ 3 files changed, 66 insertions(+) create mode 100644 journald-remote/Vagrantfile create mode 100644 journald-remote/journald-rcv.sh create mode 100644 journald-remote/journald-snd.sh diff --git a/journald-remote/Vagrantfile b/journald-remote/Vagrantfile new file mode 100644 index 0000000..bf7f42e --- /dev/null +++ b/journald-remote/Vagrantfile @@ -0,0 +1,39 @@ +IMAGE_NAME = "debian/bullseye64" +N =2 +node_ip = "192.168.56.10" +Vagrant.configure("2") do |config| + config.ssh.insert_key = false + + config.vm.provider "virtualbox" do |v| + v.memory = 512 + v.cpus = 1 + end + + config.vm.define "journald-rcv" do |master| + master.vm.box = IMAGE_NAME + master.vm.network "private_network", ip: "192.168.56.10" + master.vm.hostname = "journald-rcv" + master.vm.provision "shell" do |shell| + shell.path = "journald-rcv.sh" + end +# master.vm.provision "ansible" do |ansible| +# ansible.playbook = "kubernetes-setup/master-playbook.yml" +# ansible.extra_vars = { +# node_ip: "192.168.56.10", +# } +# end + end + + (1..N).each do |i| + config.vm.define "journald-snd-#{i}" do |node| + node.vm.box = IMAGE_NAME + node.vm.network "private_network", ip: "192.168.56.#{i + 10}" + node.vm.hostname = "journald-snd-#{i}" + node.vm.provision "shell" do |shell| + shell.path = "journald-snd.sh" + shell.args = node_ip + end + end + end +end + diff --git a/journald-remote/journald-rcv.sh b/journald-remote/journald-rcv.sh new file mode 100644 index 0000000..2265b1b --- /dev/null +++ b/journald-remote/journald-rcv.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +sudo apt-get update +sudo apt-get install -y systemd-journal-remote +sudo systemctl enable systemd-journal-remote.socket + + +sudo cp /lib/systemd/system/systemd-journal-remote.service /etc/systemd/system + +sudo sed -i 's/--listen-https=-3/--listen-http=-3/' /etc/systemd/system/systemd-journal-remote.service + +[[ -d /var/log/journal/remote ]] || sudo mkdir /var/log/journal/remote +sudo chown systemd-journal-remote /var/log/journal/remote + +sudo systemctl daemon-reload +sudo ss -lntp4 + + diff --git a/journald-remote/journald-snd.sh b/journald-remote/journald-snd.sh new file mode 100644 index 0000000..73649ab --- /dev/null +++ b/journald-remote/journald-snd.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +sudo apt-get update +sudo apt-get install -y systemd-journal-remote +rpl="s/^# URL=/URL=http:\/\/${1}:19532/" +sudo sed -i "$rpl" /etc/systemd/journal-upload.conf + +sudo systemctl enable systemd-journal-upload.service +sudo systemctl restart systemd-journal-upload.service