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

Can a service managed by systemd send its logs somewhere other than /var/log/messages?

· 52CE 我爱测

We have a RHEL 8 server where we have a few python applications installed for data management and analysis, notably JupyterHub and Airflow. We have these set up with systemd unit files so we can start, stop, restart them using sy…

问题原文

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

We have a RHEL 8 server where we have a few python applications installed for data management and analysis, notably JupyterHub and Airflow. We have these set up with systemd unit files so we can start, stop, restart them using systemctl and we access their logs using journalctl. Our infrastructure folks in charge of the server have kindly asked to make sure our applications send their log messages to somewhere other than /var/log/messages so they can debug server health without having our applications "polluting" the log. But we have not been able to identify a solution to this.

Is there a way to configure a systemd service so its logs aren't going to /var/log/messages? If not, what could we be using instead of systemd that exist within the RHEL ecosystem?

已采纳解答

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

systemd doesn't send logs to /var/log/messages; it writes things to the system journal (which you read using journalctl).

If something is writing to /var/log/messages, it's a syslog program like syslog-ng or rsyslog, which is reading from the journal and then writing to files in /var/log. If you want to change that, update your syslog server configuration (or disable it, if you don't want to write there at all).

RHEL systems typically use rsyslog, configured in /etc/rsyslog.conf (and /etc/rsyslog.d).

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

资料来源与适用范围

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

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

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