Skip to content

Add hostname to log lines - #34

Closed
gthvn1 wants to merge 1 commit into
xenserver:masterfrom
gthvn1:add-hostname-to-log
Closed

gthvn1 wants to merge 1 commit into
xenserver:masterfrom
gthvn1:add-hostname-to-log

Conversation

@gthvn1

@gthvn1 gthvn1 commented Oct 14, 2026

Copy link
Copy Markdown

When the support team gets bugtool archives from several hosts of a pool, it is hard to know which host wrote each xha.log line. This patch adds the hostname to every line in xha.log so it is easy to see.

The hostname is read once in log_initialize(), before the threads start. It is read again in log_reopen(), with the write lock held, so a new hostname appears after the log rotation. If gethostname() fails, "-" is used.

Co-developed-by: Andrii Sultanov andriy.sultanov@vates.tech

When the support team gets bugtool archives from several hosts of a
pool, it is hard to know which host wrote each xha.log line. This patch
adds the hostname to every line in xha.log so it is easy to see.

The hostname is read once in log_initialize(), before the threads start.
It is read again in log_reopen(), with the write lock held, so a new
hostname appears after the log rotation. If gethostname() fails, "-" is
used.

Co-developed-by: Andrii Sultanov <andriy.sultanov@vates.tech>
Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@vates.tech>
@gthvn1

gthvn1 commented Oct 14, 2026

Copy link
Copy Markdown
Author

Here is what it looks like now:

...
Oct 14 18:14:40 CEST 2026 xcpng-gtn [info] Joined.
Oct 14 18:14:40 CEST 2026 xcpng-gtn [info] Xapi monitor started.
Oct 14 18:14:40 CEST 2026 xcpng-gtn [info] Fencing is armed.
Oct 14 18:14:40 CEST 2026 xcpng-gtn [notice] The local host has transitioned to online state.
Oct 14 18:14:40 CEST 2026 xcpng-gtn [debug] HA daemon mlockall succeeded

@gthvn1

gthvn1 commented Oct 14, 2026

Copy link
Copy Markdown
Author

I will reopen it from xcp-ng fork

@gthvn1 gthvn1 closed this Oct 14, 2026
@gthvn1
gthvn1 deleted the add-hostname-to-log branch October 14, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant