我目前有使用 local0 到 local7 设置的 syslog 配置文件,将特定设备分配给指向设备的单独目录和文件的特定本地设施,例如:
*与系统日志服务器相关的条目
*设备 1
local1.=emerg /location/device1/00-emerg
local1.=alert /location/device1/01-alert
local1.=crit /location/device1/02-crit
*设备2
local2.=emerg /location/device2/00-emerg
local2.=alert /miramar/device2/01-alert
local2.=crit /miramar/device2/02-crit
问题是这种方式只能指定 8 个设备如何设置 syslog 以使用 8 个以上的设备?
此致
我在 Windows 上寻找类似 logparser 的东西。要求:
任何的想法?
我有一个 logrotate 脚本,它的结构是旋转 syslog 收集的日志。该脚本的一部分是重新加载系统日志进程。问题是系统日志重新加载针对它轮换的每个匹配日志文件运行,并且大约有 100 个。在处理完所有单个日志后,如何设置 logrotate 脚本以仅重新加载 syslog 进程一次?
/logs/* {
daily
rotate 7
compress
postrotate
/etc/init.d/syslog-ng reload 2>/dev/null
endscript
}
Run Code Online (Sandbox Code Playgroud) 我怀疑我们的服务器应用程序之一已达到其最大打开文件限制。
该应用程序使用自己的帐户在用户空间中运行。init 脚本启动大量进程,这些进程又启动大量子进程和大量线程。
根据我在/etc/security/limits.conf 中设置的书:
USERNAME - nofile 2048
Run Code Online (Sandbox Code Playgroud)
我怀疑应用程序已达到限制 - 通过查看临时文件目录,我发现那里有 2000 多个文件。
在将限制提高到 4096 并重新启动应用程序后,我在那里发现了 2100 多个文件。
现在的问题是:如果应用程序达到了 2048 的限制 - 为什么没有登录 /var/log/messages?
syslog-ng 是当前使用的 syslog-daemon。
/etc/syslog-ng/syslog-ng.conf
options { long_hostnames(off); sync(0); perm(0640); stats(3600); };
source src {
internal();
unix-dgram("/dev/log");
unix-dgram("/var/lib/ntp/dev/log");
};
filter f_iptables { facility(kern) and match("IN=") and match("OUT="); };
filter f_console { level(warn) and facility(kern) and not filter(f_iptables)
or level(err) and not facility(authpriv); };
filter f_newsnotice { level(notice) and facility(news); };
filter f_newscrit { level(crit) …Run Code Online (Sandbox Code Playgroud) 我很难调试一个问题,我认为这可能有两个方面 - 两个单独程序中的问题。
主要问题是我在 Ubuntu 14.04 上将 nginx 记录到 syslog,如下所示:
access_log syslog:server=unix:/dev/log,tag=nginx,facility=local7,severity=info combined
Run Code Online (Sandbox Code Playgroud)
我希望能够过滤标记为 nginx 的消息,但没有那么幸运。
filter nginx { facility(local7) and tags("nginx") }
Run Code Online (Sandbox Code Playgroud)
将 and 更改为 or 可以工作,或者只需删除标签部分,因为设施过滤器工作正常。然而,标签过滤器不会。
所以,我想使用记录器进行测试并设置一个基本测试,如下所示:
template nginx { template("timestamp=${ISODATE} host=${HOST} tags=${TAGS} msgheader=${MSGHDR} ${MSG}\n"); template-escape(no); };
filter nginx { tags("nginx"); };
destination nginx { file("/tmp/nginx.log" template(nginx)); };
log { source(s_net); filter(nginx); destination(nginx); };
Run Code Online (Sandbox Code Playgroud)
--
$ logger -n localhost -P 10001 -t nginx -p local7.info -u /tmp/ignored testing 123
Run Code Online (Sandbox Code Playgroud)
我有一个源 s_net,在端口 10001 上侦听 UDP 以进行此测试。使用记录器,我通过 UDP 登录到该端口,使用 local7 …