大网数据广告活动
服务器运维问答

Can Journalctl and syslog be used in paralled?

· 52CE 我爱测

I'm having a hard time understanding how logging works on linux. Since the inclusion of systemd, it seems a bit easier, but I still have a couple of concepts that still can't fully understand. Given a system with journalctl, I wa…

问题原文

原帖链接 · RedNano · CC BY-SA 4.0

I'm having a hard time understanding how logging works on linux.

Since the inclusion of systemd, it seems a bit easier, but I still have a couple of concepts that still can't fully understand.

Given a system with journalctl, I want to send some log messages to a remote host. For this purpose, I installed rsyslog and configured freeradius so it outputs its logs to local3, and then configured rsyslog to forward those messages under local3 to the remote syslog server. Now, are the system logs shared between rsyslog and journalctl? Can this cause a conflict of any kind?

Aside from this: Who controls what is being ritten to /var/log/messages? and how can a certain app output their logs to this file? Is it managed by rsyslog? By systemd?

If anyone can help me understand the whole linux logging service, it would be nice.

社区高分解答

原帖链接 · bodgit · CC BY-SA 4.0

The link(s) between journald and rsyslog is controlled on the rsyslog side through the use of its input and output modules; there is an imjournal and omjournal for reading from and writing to the journal respectively.

So if you write something to rsyslog, it will only appear in journald if you've configured the omjournal module.

rsyslog "owns" /var/log/messages, the usual syslog API will allow applications to write to it. Journal messages can also end up there, if the imjournal module is configured.

This short RHEL guide explains things in pretty much the same way.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。