本地系统日志记录
如何从系统日志服务器消息的日志条目中隐藏本地主机名称(而不是记录 IP 地址)?
假设我希望将 syslog 服务器的 IP 地址而不是 localhost 写入日志消息。
例如,我的 syslog 服务器示例 syslog.conf 文件可能包含本地主机用户事件日志记录的所有行:
authpriv.* /var/log/messages
日志条目可能如下所示
对于 su 会话开始于Jun 21 15:48 的 :56 localhost su: pam_unix(su:session): session opening for user root by root(uid=0)
我强烈希望来自本地主机的所有消息都将其 IP 地址写入消息日志文件而不是只是“localhost”字符串。我怎样才能让本地主机、系统日志服务器写入它的IP地址?
请告知,布莱恩
How can the localhost name be suppressed (instead log the IP address) from the log entries in a syslog server message?
Suppose I want the syslog server's IP address to be written to the log messages rather than localhost.
For example, my syslog server sample syslog.conf file might have this catch all line for the localhost user event logging:
authpriv.* /var/log/messages
The log entry might look like below for an su session start
Jun 21 15:48:56 localhost su: pam_unix(su:session): session opened for user root by root(uid=0)
I strongly prefer that all messages from the localhost write their IP addresses to the messages log file not just the 'localhost' string. How can I get the localhost, syslog server to write it's IP address?
Please advise, Bryan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果到 syslog 的连接是通过本地主机地址并且未设置主机名,我认为这是预期的行为。您使用的系统日志是什么?您的主机名设置了吗?
If the connection to syslog is over the localhost address and a hostname is not set, I think this is the expected behavior. What syslog are you using and is your hostname set?