Linux Labs

Observability: metrics, alerts, logs / Stage 7 of 9

Logs in one place

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 7 · lab · 30 minmedium

The second machine's logs are not on the collector

The team collects the logs of all machines on node1, each machine in its own directory. node2 was set up to forward its journal there, yet the collector has not a single line from it. Get the forwarding working end to end so that it survives a reboot of both machines.

Situation

The team collects the logs of all servers in one place — on node1. The collector is rsyslog: it sorts the lines of other machines into directories, one per machine — /var/log/remote/<machine name>/syslog.log. Yesterday node2 was connected to it: there rsyslog forwards to node1 everything that lands in its journal. Last night something happened on node2, and the collector has not a single line from it — not even the /var/log/remote/node2 directory.

node1 is your terminal. student logs in to node2 with a key: ssh node2 'command' or ssh node2, back — exit. sudo works without a password on both machines. The collector directory is readable with sudo.

Task

  1. A line written by logger on node2 shows up on node1 in /var/log/remote/node2/ within a few seconds.
  2. On node1 the logs are taken by rsyslog on the standard syslog port — 514: other machines will be connected to it too.
  3. The node1 firewall stays on: open in it only what the log intake needs.
  4. The setup survives a reboot of both machines.

Constraints

  • The check itself writes a logger line with its own tag on node2 and looks for it on node1. It also sends its own lines from node2 to node1:514 directly and opens an extra port on node1 for a moment — to make sure the firewall keeps it closed.
  • You do not need to reboot the machines for the check: it makes sure the running rsyslog was started with the config from its files and the nftables rules in the kernel are the ones /etc/nftables.conf will load.

There is no Internet in the lab — only the network between node1 and node2. Everything you need is installed on both machines.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 4
  • A line written by logger on node2 shows up on node1 in /var/log/remote/node2/ within a few seconds — not done yet
  • On node1 port 514 is held by rsyslog, on an address node2 can connect to — not done yet
  • The node1 firewall stays on — it lets traffic reach the log intake, while other ports stay closed to node2 — not done yet
  • The setup survives a reboot — rsyslog on both machines is enabled and runs the config from its files, the nftables rules in the kernel come from /etc/nftables.conf — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 4
  • A line written by logger on node2 shows up on node1 in /var/log/remote/node2/ within a few seconds — not done yet
  • On node1 port 514 is held by rsyslog, on an address node2 can connect to — not done yet
  • The node1 firewall stays on — it lets traffic reach the log intake, while other ports stay closed to node2 — not done yet
  • The setup survives a reboot — rsyslog on both machines is enabled and runs the config from its files, the nftables rules in the kernel come from /etc/nftables.conf — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 4
  • A line written by logger on node2 shows up on node1 in /var/log/remote/node2/ within a few seconds — not done yet
  • On node1 port 514 is held by rsyslog, on an address node2 can connect to — not done yet
  • The node1 firewall stays on — it lets traffic reach the log intake, while other ports stay closed to node2 — not done yet
  • The setup survives a reboot — rsyslog on both machines is enabled and runs the config from its files, the nftables rules in the kernel come from /etc/nftables.conf — not done yet
Loading…