Redis做消息队列
1.连接从Redis中获取日志文件并存储到ES中
[root@Logstash ~]# vim /usr/local/logstash/config/redis.conf
input {
beats {
port => "5044"
}
redis {
data_type => "list"
key => "220"
host => "192.168.200.134"
port => 6379
db => 0
threads => 1
}
}
filter {
if [type] == "nginx"{
grok {
match => { "message" => "%{NGINXACCESS}" }
}
}
date {
match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
target => ["datetime"]
}
geoip {
source => "clientip"
}
}
output {
if [fields][logsource] == "220nginx_access"{
elasticsearch {
hosts => ["192.168.200.130:9200"]
index => "220nginx_access"
}
}
if [fields][logsource] == "220nginx_error"{
elasticsearch {
hosts => ["192.168.200.130:9200"]
index => "220nginx_error"
}
}
stdout { codec => rubydebug }
}
2.将Nginx访问日志和错误日志推送到Redis消息队列中。
[root@mobanji filebeat]# egrep -v "#|^$" filebeat.yml
filebeat.prospectors:
- type: log
fields:
logsource: 220nginx_access
log_type: access_log
fields_under_root: true
paths:
- /usr/local/nginx/logs/access.log
- type: log
fields:
logsource: 220nginx_error
log_type: error_log
paths:
- /usr/local/nginx/logs/error.log
output.redis:
hosts: ["192.168.200.134"]
port: 6379
db: 0
timeout: 5
key: "220"
3.收集Nginx和Tomcat日志:
[root@mobanji ~]# egrep -v "#|^$" /usr/local/filebeat/filebeat.yml
filebeat.prospectors:
- type: log
fields:
logsource: 220nginx_access
log_type: access_log
fields_under_root: true
paths:
- /usr/local/nginx/logs/access.log
- type: log
fields:
logsource: 220nginx_error
log_type: error_log
paths:
- /usr/local/nginx/logs/error.log
- type: log
fields:
logsource: 220tomcat_out
log_type: tomcat_out
paths:
- /usr/local/tomcat/logs/catalina.out
output.redis:
hosts: ["192.168.200.134"]
port: 6379
db: 0
timeout: 5
key: "220"
Redis做消息队列的更多相关文章
- Redis除了做缓存--Redis做消息队列/Redis做分布式锁/Redis做接口限流
1.用Redis实现消息队列 用命令lpush入队,rpop出队 Long size = jedis.lpush("QueueName", message);//返回存放的数据条数 ...
- 程序员过关斩将--redis做消息队列,香吗?
Redis消息队列 在程序员这个圈子打拼了太多年,见过太多的程序员使用redis,其中一部分喜欢把redis做缓存(cache)使用,其中最典型的当属存储用户session,除此之外,把redis作为 ...
- Redis 做消息队列
一般来说,消息队列有两种场景,一种是发布者订阅者模式,一种是生产者消费者模式.利用redis这两种场景的消息队列都能够实现.定义: 生产者消费者模式:生产者生产消息放到队列里,多个消费者同时监听队列, ...
- 使用Redis做消息队列
基于内存的单线程数据库,使Redis的线程安全性极高.而Redis的双向链表数据类型(List)天生就可作为消息队列存储消息. 在这里就不说消息队列的等等一些优点.但是补充一下Redis的List类型 ...
- RabbitMQ跟Redis做消息队列的区别
区别 https://www.zhihu.com/question/20795043 https://blog.csdn.net/dd18709200301/article/details/79077 ...
- Redis做消息队列文章两篇
介绍:http://www.cnblogs.com/lhfcws/p/3732535.html 具体做法:http://shift-alt-ctrl.iteye.com/blog/1867454 另外 ...
- 使用Redis Stream来做消息队列和在Asp.Net Core中的实现
写在前面 我一直以来使用redis的时候,很多低烈度需求(并发要求不是很高)需要用到消息队列的时候,在项目本身已经使用了Redis的情况下都想直接用Redis来做消息队列,而不想引入新的服务,kafk ...
- PHP使用Redis实现消息队列
消息队列可以使用MySQL来实现,可以参考博客PHP使用MySQL实现消息队列,虽然用MySQL可以实现,但是一般不这么用,因为MySQL的数据都存在硬盘中,而从硬盘中对MySQL的操作,I/O花费的 ...
- rabbitmq和redis用作消息队列的区别
将redis发布订阅模式用做消息队列和rabbitmq的区别: 可靠性redis :没有相应的机制保证消息的可靠消费,如果发布者发布一条消息,而没有对应的订阅者的话,这条消息将丢失,不会存在内存中:r ...
随机推荐
- [学习笔记] Blender 模型编辑-挤出
按TAB键进入模型编辑模式,再次按TAB键退出编辑模式. 或者在菜单按 Modeling 也会进入编辑模式. 进入编辑模式之后,会显示如下额外的工具栏: 下面分别对应点.线.面三种选择方式:选择了两个 ...
- [转帖]Linux系列之SAR命令使用详解
Linux系列之SAR命令使用详解 sar是System Activity Reporter(系统活动情况报告)的缩写.这个工具所需要的负载很小,也是目前linux中最为全面的性能分析工具之一.此款工 ...
- [转帖]Swagger介绍及使用
Swagger介绍及使用 32018.12.07 01:39:21字数 2241阅读 89207 https://www.jianshu.com/p/349e130e40d5 导语: 相信无论是前端还 ...
- K8S从入门到放弃系列-(3)部署etcd集群
摘要:etcd 是k8s集群最重要的组件,用来存储k8s的所有服务信息, etcd 挂了,集群就挂了,我们这里把etcd部署在master三台节点上做高可用,etcd集群采用raft算法选举Leade ...
- MySQL安装与连接
1.安装 下载地址:https://dev.mysql.com/downloads/mysql/ 常见问题及解决办法:https://blog.csdn.net/chen97_08/article/d ...
- uboot 代码执行顺序
ref:http://blog.chinaunix.net/uid-30352139-id-5128405.html uboot: 2014.07 1.1 U-boot相关文件 boards.c ...
- 工具——eclipse debug小技巧
1.开启调试: 在代码编辑处右键单击,在弹出菜单中点击Debug As开始调试 2.几个快捷键: F5:跟入Step into, 一般会跟踪进入到调用函数的函数体,Step Over则不会跟踪进入,直 ...
- excelize
// 参考:https://gitee.com/xurime/excelize // github.com/360EntSecGroup-Skylar/excelize
- Django-redis配置cache和session
CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", &q ...
- git this exceeds GitHub's file size limit of 100.00 MB
git push origin master过程中,出现如下错误 关键词:this exceeds GitHub's file size limit of 100.00 MB 推的时候忽略文件的操作: ...