代码之家  ›  专栏  ›  技术社区  ›  User1

如何为另一台计算机发送系统日志条目?

  •  0
  • User1  · 技术社区  · 16 年前

    “there”创建一个输出文件并将其发送到“here”进行一些处理这里“对输出运行一个shell脚本并使用 logger 将结果发送到syslog聚合器。不幸的是,日志聚合器认为消息来自“here”,但我希望消息看起来来自“there”。

    简而言之,我运行:

    echo "Hello World"|logger -p local1.alert

    2010-11-09T15:40:11.516811-06:00 here logger: Hello World

    但是想要:

    2010-11-09T15:40:11.516811-06:00 there logger: Hello World

    记录器 使流量从另一个主机显示?无法更改我使用的实际邮件格式。

    4 回复  |  直到 16 年前
        1
  •  0
  •   freiheit    16 年前

    我相信logger的答案是“不”。

    logger可能使用syslog(3)库例程,该例程没有在日志项中设置主机的规定。

    您可以编写自己的logger版本,以您想要的方式通过线路发送日志。 http://www.faqs.org/rfcs/rfc3164.html

        2
  •  1
  •   grossvogel    16 年前

    您可以使用logger的-t选项标记“there”中的每一行。

    否则,您可能需要让这个系统的另一部分来移动或编写您自己的日志。。。

        3
  •  1
  •   Brad    12 年前

    Syslog和Syslog ng支持将日志发送到其他计算机。这就是为什么在输出中有一个hostname字段!(描绘它们)。它已经做了很多年了。否则,系统管理员将不得不四处收集十亿台计算机的日志来监视他们的系统。

    syslogd(8) provides full remote logging, i.e. is able to send mes-
    sages to a remote host running syslogd(8) and to receive messages  from
    remote hosts.  The remote host won’t forward the message again, it will
    just log them locally.  To forward messages to  another  host,  prepend
    the hostname with the at sign (‘‘@’’).
    

    有关详细信息,请参阅syslog.conf手册页

        4
  •  0
  •   LtWorf    13 年前

    我的男记录员让我用

    logger -n IP
    
    推荐文章