rsyslog

使用Haproxy搭建群集

无人久伴 提交于 2019-12-26 14:36:15
常见的web集群调度器 目前常见的web集群调度器分为软件和硬件,软件通常使用开源的LVS,Haproxy,Nginx,硬件一般使用比较多的是F5,也有很多人使用国内的一些产品,如梭子鱼,绿盟等 Haproxy应用分析 LVS在企业应用中抗负载能力很强,但存在不足 LVS不支持正则处理,不能实现动静分离 对于大型网站,LVS的实施配置复杂,维护成本相对较高 Haproxy是一款可提供高可用性,负载均衡,及基于TCP和HTTP应用的代理的软件 特别适用于负载特别大的web站点 运行在当前的硬件上可支持数以万计的并发连接连接请求 Haproxy调度算法原理 RR:最简单常用的,轮询调度 LC:最小连接数算法,根据后端的节点连接数大小动态分配前端请求 SH:来源访问调度算法,用于有session会话记录在服务器端,可以基于来源ip,cookie做群集调度 Haproxy日志管理 Haproxy的日志默认是输出到系统的syslog中,在生产环境中一般单独定义出来 定义的方法步骤 修改Haproxy配置文件中关于日志配置的选项,加入配置: log /devlog local0 info log /dev/log local0 notice 修改rsyslog配置,将Haproxy相关的配置独立定义到haproxy.conf,并放到/etc/rsyslog.d/下

Disable timestamp

送分小仙女□ 提交于 2019-12-25 07:58:49
问题 How can I disable the timestamp (default template I think)? I use rsyslog to send Apache access.log but I don't want the rsyslog timestamp... Nov 26 14:13:21 remotehost apache: 1.2.3.4 - user [26/Nov/2012:14:13:21 +0100] "GET /index.php HTTP/1.1" 200 2430 "https://1.2.3.4" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;" Can anyone suggest a template? 回答1: on log server: $ModLoad imudp $UDPServerAddress 1.1.1.1 $UDPServerRun 514 $AllowedSender UDP, 1.1.1.2 $template MsgFormat,"%msg%\n"

How to verify rsyslog TCP communication with the server from the client side?

自作多情 提交于 2019-12-24 15:29:38
问题 I want to be able to know if all of the servers that I am logging to are properly receiving my TCP messages and answering back. I don't want to have to implement anything else on the server side, just want to monitor everything in the client machine. I want to be able to do something like a ping test but valid for a rsyslog environment, using its protocols and ports. I also know that there is a "debug" file but I believe its too much complicated to actually debug. 回答1: impstats can give you

How do I find my program name?

元气小坏坏 提交于 2019-12-23 18:13:58
问题 Problem I am unable to write to a different log than the default one using syslog. I am unsure if maybe my app name is wrong in my configuration. Do "program name" and "process name" not mean the same thing? If not, how can I find my program name in Python 3.6? Attempted I have written a small application in Python 3.6. I am already successfully writing to a common syslog file in CentOS 7 at /var/log/messages with it. If I open that file, I can see my entries. If I run ps aux | grep myappname

rsyslog performance optimization

五迷三道 提交于 2019-12-22 13:07:31
问题 What should be done to setup rsyslog for best performance? We can allow some items to be lost on server crash or just lost. We are going to save logs to the MySQL DB. We would like to be able to handle at least 100 log writes per second with latency 0.001 - 0.005 second. We are writing logs from PHP application. Thank you for help. 回答1: We just went through a similar exercise using MongoDB as the database, so I'll document what we did and hope it helps you. It was our first time using rsyslog

rsyslog+loganalyzer配置

∥☆過路亽.° 提交于 2019-12-21 12:59:55
1、loganalyzer服务器搭建 [root@localhost ~]# getenforce #查看selinux是否关闭 [root@localhost ~]# setenforce 0 #临时关闭;修改配置文件/etc/selinux/config,将其中SELINUX设置为disabled(永久关闭) [root@localhost ~]# systemctl status firewalld.service [root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# yum install mariadb mariadb-server -y [root@localhost ~]# systemctl start mariadb.service [root@localhost ~]# /bin/mysql_secure_installation #初始化mariadb数据库 [root@localhost ~]# yum install rsyslog-mysql -y [root@localhost ~]# mysql -uroot -proot </usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql MariaDB [(none)]>

<二>ELK-6.5.3学习笔记–使用rsyslog传输管理nginx日志

白昼怎懂夜的黑 提交于 2019-12-21 03:56:05
http://www.eryajf.net/2362.html 转载于 本文预计阅读时间 28 分钟 文章目录[隐藏] 1,nginx日志json化。 2,发送端配置。 3,接收端配置。 4,配置logstash。 5,简单使用kibana。 现在有好几台主机的nginx日志想要监控分析一下,那么,如何让远程主机的日志都乖乖的来到elk主机之上呢,这是一个需要考虑的问题,而这里,我就使用rsyslog来完成。 这种方式貌似针对于远程主机上只有单项日志的情况,就像我们现在做的,只处理nginx的访问日志一般的,如果还有更多的日志需要从远程转发到elk集群中,就需要用其他方式了,或者说我只会配置这么一种,更复杂的,目前还玩不转。后来哈,在当我测试rsyslog转发多个日志的时候,发现,里边配置规则过于复杂,分类方面也非常不给力,就此打住,一旦多个日志,直接用filebeat即可。 现在,废话不多说,直接进入正题。 目前的思路,可以通过下图了解: 说明: 图中举例了两台nginx,其实可以有更多台nginx日志可以想后方转发。 双方以rsyslog作为桥梁,从而实现日志的中转运输。其中nginx主机上是发送端,elk主机上是接收端。 针对不同的nginx日志,可以启动不同的logstash实例,然后将日志转发给es。 由es,统一将日志转给kibana。

rsyslog template - parse failure in regular expression

扶醉桌前 提交于 2019-12-20 03:31:58
问题 I am trying to structure logs from my D-Link DAP-2310 in a rsyslog server. It has a non-standard log format and my idea is to fix that with regex in a rsyslog template. When I parse the rsyslog.conf with rsyslogd -N1 the result is really depressing. The msg data item looks like AA:BB:CC:DD:EE] [app-name] log message The first part is a mac address where the first part “[00:” is placed in another data item, don't ask why. Part two “[app-name]” is the application/instance sending the message.

日志管理

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 15:40:41
日志管理 1. 系统日志介绍 1.1 sysklogd 系统日志服务 CentOS 5 之前版本采用的日志管理系统服务 syslogd: system application 记录应用日志 klogd: linux kernel 记录内核日志 事件记录格式: 日期时间 主机 进程[pid]: 事件内容 C/S架构:通过TCP或UDP协议的服务完成日志记录传送,将分布在不同主机的日志实现集中管理 1.2 rsyslog 系统日志服务 CentOS 6 以后版本的系统管理服务 rsyslog特性: 多线程 UDP, TCP, SSL, TLS, RELP MySQL, PGSQL, Oracle实现日志存储 强大的过滤器,可实现过滤记录日志信息中任意部分 自定义输出格式 2. 日志管理 2.1 rsyslog 管理 2.1.1 系统日志术语 facility:设施,从功能或程序上对日志进行归类 auth, authpriv, cron, daemon,ftp,kern, lpr, mail, news, security(auth), user, uucp, local0-local7, syslog Priority 优先级别,从低到高排序 debug, info, notice, warn(warning), err(error), crit(critical), alert,

详述Haproxy搭建web群集

给你一囗甜甜゛ 提交于 2019-12-14 23:32:17
常见的Web集群调度器 目前常见的Web集群调度器分为软件和硬件,软件通常使用开源的LVS、Haproxy、Nginx,硬件一般使用比较多的时F5,也有很多人使用国内的一些产品,如梭子鱼、绿盟等 Haproxy应用分析 LVS在企业应用中抗负载能力强,但存在不足 LVS不支持正则处理,不能实现动静分离 对于大型网站,LVS的实施配置复杂,维护成本相对较高 Haproxy是一款可提供高可用性、负载均衡、及基于TCP和HTTP应用的代理的软件 特别适用于负载特别大的Web站点 运行在当前的硬件上可支持数以万计的并发连接请求 Haproxy调度算法原理 Haproxy支持多种调度算法,最常用的有三种 RR (Round Robin) RR算法是最简单最常用的一种算法,即轮询调度 理解举例 有三个节点A、B、C,第一个用户访问会被指派到节点A,第二个用户访问会被指派到节点B,第三个用户访问会被指派到节点 第四个用户访问继续指派到节点A,轮询分配访问请求实现负载均衡效果 LC (Least Connections) LC算法即最小连接数算法,根据后端的节点连接数大小动态分配前端请求 理解举例 有三个节点A、B、C,各节点的连接数分别为A:4、B:5、 C:6, 此时如果有第一个用户连接请求,会被指派到A上,连接数变为A:5、B:5、 C:6 第二个用户请求会继续分配到A上,连接数变为A:6