syslog

关于MySQL AUDIT(审计)那点事

匿名 (未验证) 提交于 2019-12-02 22:02:20
2017年06月02日MySQL社区版本最新版为MySQL_5.7.18,但是该版本不带AUDIT功能(MySQL Enterprise Edition自带AUDIT功能), 因此需要加载plugin(第三方插件),当前插件有以下几种: 备注:MySQL企业版本才能使用这个audit插件哦,MySQL社区版慢慢等着吧 备注:人家说了,我这个插件只能给Percona_sever使用,我Percona来维护 下载地址: http://dl.bintray.com/mcafee/mysql-audit-plugin/ 部署可参考: http://blog.csdn.net/bzfys/article/details/53695855 个人发现该插件貌似不支持审计日志自动切割,而且日志格式为JSON格式,个人感觉不易查看,以及时间格式需要转换 eg:"msg-type":"header","date":"1494935783266","audit-version":"1.1.4-707","audit-protocol-version":"1.0","hostname":"salt-master","mysql-version":"5.7.18-log","mysql-program":"/usr/sbin/mysqld","mysql-socket":"/data/mysql/mysql

Log4net: SysLog Appender Example

佐手、 提交于 2019-12-02 21:49:37
I am looking for example configuration on how to get Log4net logging to a Syslog server. Any help would be welcome. Orwellophile I didn't find Simon Whittemore's entry very helpful, this is what got my appender producing "proper" syslog remote messages: <appender name="RemoteSyslogAppender" type="log4net.Appender.RemoteSyslogAppender"> <identity value="HepeManok" /> <layout type="log4net.Layout.PatternLayout" value="%-5p %type: %m%n"/> <remoteAddress value="syslog.lameserver.net" /> </appender> The "key" [sic] is the identity parameter, that produces the correct (or correct looking) output - I

Can syslog Performance Be Improved?

爷,独闯天下 提交于 2019-12-02 16:52:37
We have an application on Linux that used the syslog mechanism. After a week spent trying to figure out why this application was running slower than expected, we discovered that if we eliminated syslog, and just wrote directly to a log file, performance improved dramatically. I understand why syslog is slower than direct file writes. But I was wondering: Are there ways to configure syslog to optimize its performance? You can configure syslogd (and rsyslog at least) not to sync the log files after a log message by prepending a "-" to the log file path in the configuration file. This speeds up

Redirect C++ std::clog to syslog on Unix

孤者浪人 提交于 2019-12-02 15:37:10
I work on Unix on a C++ program that send messages to syslog. The current code uses the syslog system call that works like printf. Now I would prefer to use a stream for that purpose instead, typically the built-in std::clog . But clog merely redirect output to stderr, not to syslog and that is useless for me as I also use stderr and stdout for other purposes. I've seen in another answer that it's quite easy to redirect it to a file using rdbuf() but I see no way to apply that method to call syslog as openlog does not return a file handler I could use to tie a stream on it. Is there another

第三方日志库logrus使用

痴心易碎 提交于 2019-12-02 14:40:07
摘自: https://www.cnblogs.com/Dr-wei/p/11742394.html 第三方日志库logrus使用 日志是程序中必不可少的一个环节,由于Go语言内置的日志库功能比较简洁,我们在实际开发中通常会选择使用第三方的日志库来进行开发。本文介绍了 logrus 这个日志库的基本使用。 logrus介绍 Logrus是Go(golang)的结构化logger,与标准库logger完全API兼容。 它有以下特点: 完全兼容标准日志库,拥有七种日志级别: Trace , Debug , Info , Warning , Error , Fatal and Panic 。 可扩展的Hook机制,允许使用者通过Hook的方式将日志分发到任意地方,如本地文件系统,logstash,elasticsearch或者mq等,或者通过Hook定义日志内容和格式等 可选的日志输出格式,内置了两种日志格式JSONFormater和TextFormatter,还可以自定义日志格式 Field机制,通过Filed机制进行结构化的日志记录 线程安全 安装 go get github.com/sirupsen/logrus 基本示例 使用Logrus最简单的方法是简单的包级导出日志程序: package main import ( log "github.com/sirupsen

Ubuntu 设置 log 级别

巧了我就是萌 提交于 2019-12-02 11:19:53
Linux环境下使用rsyslog管理日志 rsyslog linux运维 linux 22.7k 次阅读 · 读完需要 22 分钟 在 Linux 系统中,日志文件记录了系统中包括内核、服务和其它应用程序等在内的运行信息。 在我们解决问题的时候,日志是非常有用的,它可以帮助我们快速的定位遇到的问题。 在 Cent OS 6中,日志是使用 rsyslogd 守护进程进行管理的,该进程是之前版本的系统中 syslogd 的升级版,对原有的日志系统进行了功能的扩展,提供了诸如过滤器,日志加密保护,各种配置选项,输入输出模块,支持通过 TCP 或者 UDP 协议进行传输等。 rsyslog 的配置文件为 /etc/rsyslog.conf , 大多数日志文件都位于 /var/log/ 目录中。 定位日志文件 大多数日志文件都位于 /var/log/ 目录中。在该目录中,你可能注意到很多日志文件末尾包含一串数字(如 maillog-20150301 ),这说明这些日志文件经过了日志转储,这样可以避免日志文件过大。 在软件包 logrotate 中包含了一个定时任务,根据 /etc/logrotate.conf 文件和 /etc/logrotate.d/ 目录中的的配置定期的转储日志文件。 Rsyslog基本配置 Rsyslog 的主要配置文件为 /etc/rsyslog.conf 文件

syslog发送日志时屏蔽掉时间名称信息

不羁岁月 提交于 2019-12-02 08:52:12
问题描述: 在使用syslog发送日志的时候对方接收到的报文前面总有时间和主机名称等信息。 这个是syslog的标准输出格式,其中<14>是PRI部分,由尖括号包含的一个数字构成,这个数字包含了程序模块(Facility)、严重性(Severity),这个数字是由Facility乘以 8,然后加上Severity得来。后面的分别是时间和主机名。 使用的类:org.graylog2.syslog4j.SyslogIF;org.graylog2.syslog4j.Syslog; 解决方法: SyslogIF syslog = Syslog.getInstance("udp"); **syslog.getConfig().setSendLocalName(false);**//根据方法名就可看出是发送名称 **syslog.getConfig().setSendLocalTimestamp(false);**//发送时间 这里贴出其他方法: 来源: https://blog.csdn.net/qq_40406736/article/details/102746739

[apue] syslog 导致 accept 出错?

痞子三分冷 提交于 2019-12-02 06:01:23
前几天在看apue第16章关于socket的例子,就是一个非常典型的socket服务器,关键代码如下: void serve (int sockfd) { int ret; int clfd; int status; FILE *fp; pid_t pid; char buf[BUFLEN]; for (;;) { clfd = accept (sockfd, NULL, NULL); if (clfd < 0) { syslog (LOG_ERR, "accept error: %d, %s", errno, strerror (errno)); //if (errno == EOPNOTSUPP) //{ // syslog (LOG_INFO, "retry.."); // continue; //} exit (1); } fp = popen ("/usr/bin/uptime", "r"); if (fp == NULL) { sprintf (buf, "error: %s\n", strerror (errno)); ret = send (clfd, buf, strlen (buf), 0); syslog (LOG_ERR, "write back %d for error", ret); } else { while (fgets (buf, BUFLEN,

Reading least significant bits in Python

家住魔仙堡 提交于 2019-12-02 00:28:08
问题 I am having to parse the Facility and Severity of syslog messages in Python. These values come with each message as a single integer. The severity of the event is 0-7, specified in the 3 least significant bits in the integer. What is the easiest/fastest way to evaluate these 3 bits from the number? The code I have right now just does a 3 bit right shift, than multiplies that number times 8, and subtracts the result from the original. FAC = (int(PRI) >> 3) SEV = PRI - (FAC * 8) There must be a

Reading least significant bits in Python

半腔热情 提交于 2019-12-01 22:00:37
I am having to parse the Facility and Severity of syslog messages in Python. These values come with each message as a single integer. The severity of the event is 0-7, specified in the 3 least significant bits in the integer. What is the easiest/fastest way to evaluate these 3 bits from the number? The code I have right now just does a 3 bit right shift, than multiplies that number times 8, and subtracts the result from the original. FAC = (int(PRI) >> 3) SEV = PRI - (FAC * 8) There must be a less convoluted way to do this- rather than wiping out the bits, and subtracting. SEV = PRI & 7 FAC =