Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何为另一台机器发送系统日志条目?_Linux_Bash - Fatal编程技术网

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

Linux 如何为另一台机器发送系统日志条目?,linux,bash,Linux,Bash,我有两台机器,“这里”和“那里” “there”创建一个输出文件并将其发送到“here”进行处理。“here”在输出上运行shell脚本,并使用logger将结果发送到syslog聚合器。不幸的是,日志聚合器认为消息来自“here”,但我希望消息看起来来自“there” 简言之,我运行: echo“Hello World”|记录器-p local1.警报 并获得: 2010-11-09T15:40:11.516811-06:00这里记录器:你好,世界 但是我想要: 2010-11-09T15:4

我有两台机器,“这里”和“那里”

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

简言之,我运行:

echo“Hello World”|记录器-p local1.警报

并获得:

2010-11-09T15:40:11.516811-06:00这里记录器:你好,世界

但是我想要:

2010-11-09T15:40:11.516811-06:00那里的记录器:你好,世界


是否有方法使用
记录器
使流量显示在不同的主机上?我使用的实际消息格式无法更改。

我相信logger的答案是“否”

记录器可能使用syslog(3)库例程,该例程没有在日志条目中设置主机的规定


您可以编写自己版本的记录器,以您想要的方式通过线路发送日志

我相信使用logger的答案是“不”

记录器可能使用syslog(3)库例程,该例程没有在日志条目中设置主机的规定


您可以编写自己版本的记录器,以您想要的方式通过线路发送日志

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

如果这破坏了某些日志使用者的格式,您可以在使用日志之前对其进行预处理,替换所有标记行的主机名并删除标记


否则,您可能需要让此系统的另一部分移动或写入您自己的记录器…

您可以使用记录器的-t选项从“那里”标记每一行

如果这破坏了某些日志使用者的格式,您可以在使用日志之前对其进行预处理,替换所有标记行的主机名并删除标记


否则,您可能需要让此系统的另一部分移动或写入您自己的记录器…

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

从“syslog.conf”手册页:

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手册页

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

从“syslog.conf”手册页:

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手册页

logger -n IP

我的人告诉我使用

logger -n IP