0

I am trying to learn about UTS namespace. I want to write some log entries from both a parent namespace and a child UTS namespace. This is for demonstration purposes, so it doesn't matter if rsyslog writes to the same log file or separate log files for each namespace. The only thing that matters is that the child namespace writes logs with a different hostname from parent namespace. But I can't seem to preserve the two different hostnames.

Here is my latest attempt:

I have two SSH terminal windows opened both with the same user.

Go to Terminal 1

me@localhost: sudo unshare --uts /bin/bash
root@localhost: hostname api1
root@localhost: hostname
api1
root@localhost: rsyslogd -n -i /var/run/rsyslogd-child.pid -f /etc/rsyslog.conf &
root@localhost: logger foochild1

Go to Terminal 2

me@localhost: logger fooparent1

Now in my /var/log/syslog, both entries were recorded with the hostname from the child namespace:

Mar  8 22:47:12 api1 root: foochild1
Mar  8 22:47:33 api1 me: fooparent1

Can someone suggest to me a way to write log files from different namespaces while also preserving the hostname of the respective namespaces?

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.