Logtash遇到的异常和注意点
1.Logtash遇到的异常和注意点
1.1 logstash使用kafka插件和es集成
如果logstash使用kafka插件和es集成,必须设置kafka插件参数 session_timeout_ms => “10000” max_poll_records => “500” 如果这2个值过高会导致es重复消费,而kafka中的offset偏移不会进行增加
列出我的生产环境中拉取kafka的配置文件
个人认为还有待优化。。。
[www@logstash001 config]$ cat logstash-game-kafka.conf
input {
kafka {
id => "game-kafka-input"
bootstrap_servers => ["10.10.147.43:9092"]
group_id => "logstash"
topics => ["java-error", "java-info"]
codec => "json"
#auto_offset_reset => "latest"
}
}
filter {
json {
source => "message"
remove_field => [ "message" ]
}
if [jv_class] == "RocketmqClient" or [jv_method] == "sendHeartbeatToAllBroker" {
drop { }
}
if [jv_message] =~ "The requested url:.*.ico" { drop { } }
mutate {
remove_field => ["@version","[beat][name]","[beat][version]","[beat][hostname]"]
}
if "beats_input_codec_json_applied" in [tags] {
mutate {
remove_tag => ["beats_input_codec_json_applied"]
}
}
date {
match => [ "jv_time" ,"ISO8601" ]
}
mutate {
gsub => [
"nx_upstream_host", "-", "0",
"nx_upstream_time", "-", "0",
"nx_upstream_status", "-", "0",
"nx_upstream_connect_time", "-", "0"
]
}
mutate {
convert => {"nx_upstream_time"=>"float"}
convert => {"nx_upstream_response_length"=>"integer"}
convert => {"nx_upstream_connect_time"=>"float"}
}
}
output {
elasticsearch {
hosts => ["http://10.10.147.36:9200","http://10.10.147.37:9200","http://10.10.147.38:9200","http://10.10.147.46:9200","http://10.10.147.47:9200"]
user => xxxxxxxxxxxxxxxxx
password => "xxxxxxxxxxxxxxxxxxxx"
index => "game-%{lb_log_type}-%{+YYYY.MM.dd}--"
}
}
1.2 ”retrying failed action with response code: 429
Logstash提示这样的错误是因为bulk operations queue满了,要么调小flush_size的值,或者增大elasticsearch的thread 增大Elasticsearch的bulk线程池队列 配置文件中增加 threadpool.bulk.queue_size: 1000
1.3 logstash数据插入es中效率太慢
增到配置文件中的batch-size和workers和pipeline的参数
列出一些我的生产环境配置
[www@logstash001 config]$ cat logstash.yml
# Settings file in YAML
path.data: /data/www/logstash
pipeline.workers: 32
#pipeline 线程数
#pipeline.output.workers: 16
#
pipeline.batch.size: 50000
#每次发送的事件数
pipeline.batch.delay: 5
#发送延时
config.reload.automatic: true
config.reload.interval: 10s
log.level: info
path.logs: /log/logstash
xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.hosts: ["http://xxx.xxx.xxx.xxx:9200"]
xpack.monitoring.elasticsearch.username: "xxxxxxxxxx"
xpack.monitoring.elasticsearch.password: "xxxxxxxxxxxxxxx"
1.4 使用ruby函数进行过滤
logstash5.0使用ruby设置值和取值 例子:code => “event.set(‘server_time’ , Time.now())”设置当前server_time值为当时时间 code => “event.get(‘server_time’)” 获取server_time的值 logstash5.0之前使用ruby 列子:code => “event.[‘se , rver_time’] = Time.now()”设置当前server_time值为当时时间 code => “event.[‘server_time’]”获取server_time的值
1.5 Auto offset commit failed for group clio-consr-biz-go1:
报错提示:
Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured session.timeout.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.
提交消费组offset失败,无法完成重新分配partition。 网上描述:该问题是因为logstash无法在限定时间内消费完所有的数据,超出了kafka端设定的session timeout,导致session挂掉,且之前消费过的数据offset未能返回给kafka。在kafka端会认为该数据没有正确消费,并进行重新partition。logstash端超时后会重新建立consumer进行数据拉取,而kafka端会因为offset的问题重新发送之前“消费失败”的数据。 解决办法,增加session.timout.ms的值或者减少max.poll.records。 注意session.timout.ms增大的同事也要增加request.timeout.ms参数,而已session.timeout.ms要小于request.timeout.ms
我在kafka 的配置文件增加了上面说的参数:
[www@kafkasrv001 config]$ pwd
/data/soft/kafka/config
[www@kafkasrv001 config]$ vim consumer.properties
session.timout.ms=7000
[www@kafkasrv001 config]$ pwd
/data/soft/kafka/config
[www@kafkasrv001 config]$ vim producer.properties
request.timeout.ms=10000
1.6 一定要记得在使用的机器上修改hosts文件!
否则会造成无法连接kafka的情况。因为在某些情况下,连接是直接使用hostname进行的。
1.7 filebeat数据进入logstash
所有filebeat定义的field都是string类型,而进入kafka再进去logstash,kafka会自动识别field转换类型
1.8 Similar Posts
Logtash遇到的异常和注意点的更多相关文章
- Logtash 配置文件解析-转载
转载地址:https://dongbo0737.github.io/2017/06/13/logstash-config/ Logtash 配置文件解析 logstash 一个ELK架构中,专门用来进 ...
- alias导致virtualenv异常的分析和解法
title: alias导致virtualenv异常的分析和解法 toc: true comments: true date: 2016-06-27 23:40:56 tags: [OS X, ZSH ...
- ASP.NET Core应用的错误处理[2]:DeveloperExceptionPageMiddleware中间件如何呈现“开发者异常页面”
在<ASP.NET Core应用的错误处理[1]:三种呈现错误页面的方式>中,我们通过几个简单的实例演示了如何呈现一个错误页面,这些错误页面的呈现分别由三个对应的中间件来完成,接下来我们将 ...
- 记一次tomcat线程创建异常调优:unable to create new native thread
测试在进行一次性能测试的时候发现并发300个请求时出现了下面的异常: HTTP Status 500 - Handler processing failed; nested exception is ...
- 使用JSONObject.fromObject的时候出现“There is a cycle in the hierarchy”异常 的解决办法
在使用JSONObject.fromObject的时候,出现“There is a cycle in the hierarchy”异常. 意思是出现了死循环,也就是Model之间有循环包含关系: ...
- SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论
异常汇总:http://www.cnblogs.com/dunitian/p/4523006.html#signalR 后台创建了一个DntHub的集线器 前台在调用的时候出现了问题(经检查是代理对象 ...
- [C#] C# 知识回顾 - 你真的懂异常(Exception)吗?
你真的懂异常(Exception)吗? 目录 异常介绍 异常的特点 怎样使用异常 处理异常的 try-catch-finally 捕获异常的 Catch 块 释放资源的 Finally 块 一.异常介 ...
- [C#] C# 知识回顾 - 学会处理异常
学会处理异常 你可以使用 try 块来对你觉得可能会出现异常的代码进行分区. 其中,与之关联的 catch 块可用于处理任何异常情况. 一个包含代码的 finally 块,无论 try 块中是否在运行 ...
- [C#] C# 知识回顾 - 学会使用异常
学会使用异常 在 C# 中,程序中在运行时出现的错误,会不断在程序中进行传播,这种机制称为“异常”. 异常通常由错误的代码引发,并由能够更正错误的代码进行 catch. 异常可由 .NET 的 CLR ...
随机推荐
- 前端监控平台 & 架构
前端监控平台 & 架构 1px 透明的 gif 字节小, 43 bytes 支持跨域, 兼容场景多,零配置 https://en.wikipedia.org/wiki/GIF demo htt ...
- SVG & convert polygon/polyline to path
SVG & convert polygon/polyline to path SVG Polygon/Polyline to Path Converter https://codepen.io ...
- 02.描述统计 (descriptive statistics)
1.数据的可靠性和有效性 2.利用图表对数据进行可视化 2.1分类变量的可视化 2.11无序分类变量 2.12有序分类变量的可视化 2.1数值变量的可视化 数据的分布
- Hive安装与配置——2.3.5版本
Hive安装配置 Hive是一个数据仓库基础工具在Hadoop中用来处理结构化数据.它架构在Hadoop之上,提供简单的sql查询功能,可以将sql语句转换为MapReduce任务进行运行,使查询和分 ...
- 用友U8+V12.0安装教程(有需要软件和服务的可以联系我)
有需要用友U8+V12.0软件和服务的可以联系我 QQ:751824677 1.退出所有杀毒软件 2.先装服务器SQL2008 3.服务器(会计): 经典应用模式--全产品 (解压A盘-执行-Aut ...
- [计算机图形学]Blinn-Phong光照模型
目录 一.前言 二.原理 三.代码 一.前言 Blinn-Phong光照模型以Phong模型为基础的,提供比Phong更柔和.更平滑的高光,而且由于Blinn-Phong的光照模型省去了计算反射光线的 ...
- matlab load函数用法 实例
一 语法: load(filename) load(filename,variables) load(filename,'-ascii') load(filename,'-mat') load(fil ...
- 从HashMap面试聊聊互联网内卷
微信公众号:大黄奔跑 关注我,可了解更多有趣的面试相关问题. 写在之前 毫无疑问,回想2020年有什么词出现在眼前最多的,无疑是"996"和"内卷",从马老师的 ...
- 基于docker搭建DNSmasq
一.概述 DNSmasq是一个小巧且方便地用于配置DNS和DHCP的工具,适用于小型网络,它提供了DNS功能和可选择的DHCP功能.它服务那些只在本地适用的域名,这些域名是不会在全球的DNS服务器中出 ...
- 后端程序员之路 4、一种monitor的做法
record_t包含_sum._count._time_stamp._max._min最基础的一条记录,可以用来记录最大值.最小值.计数.总和metric_t含有RECORD_NUM(6)份recor ...