当前位置:网站首页>Summary of Logstash log data write exception troubleshooting
Summary of Logstash log data write exception troubleshooting
2022-08-11 02:25:00 【ZWZhangYu】
Article table of contents
Background and problem analysis
Write the logs of multiple services to Logstash through Filebeat, where Filebeat is deployed in a SideCar mode container, and now it is necessary to write data from multiple sources into an ES index by means of tags.
My steps:
[1] Modify the configMap configuration corresponding to fileBeat on K8S
[2] Modify the logstash configuration, first copy a configuration backup, and then add additional tagsLabel.
Question one
logstash[]: java.util.concurrent.RejectedExecutionException: event executor terminated
This problem occurs after startup. The reason for the above problem is that I cp a configuration file in the logstash configuration directory, which eventually leads to multiple conf files in the configuration directory.This needs to be noted that multiple configuration files are not allowed in the configuration directory. If you need to backup, you can put them in an external directory.
Problem 2
After solving this problem, I found another problem, only the log data of one of the services was seen in the ES index, the data of other services was not stored in the database, and the service log data that could have been stored in the database was alsoNot in stock.
Check the FileBeat service, there is no problem with normal operation.
Check Logstash service and observe its log data
[logstash.outputs.elasticsearch] Could not indexevent to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"logstash-info-2022.07.13", :_type=>"_doc", :routing=>nil},#], :response=>{"index"=>{"_index"=>"logstash-info-2022.07.13", "_type"=>"_doc", "_id"=>"LzhC9oEB0ca6UQlyyblY", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse field [message] of type [text] in document with id 'LzhC9oEB0ca6UQlyyblY'", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=span>>"Can't get text on a START_OBJECT at 1:378"}}}}} Some logs can be output normally, but some log data have warnings as shown in the figure above.It can be seen that the reason for the error is that the type of message does not match when it is mapped to the ES index.Considering the normal operation of the previous log, compare the currently inserted index record with the previous index record, 
The above picture is a comparison of the index records that can be stored in yesterday and currently, and it can be found that the storage structure of the two messages is different.Because the data types of the indexed fields are inconsistent, two logs with different JSON formats cannot be mapped to one index.
Because the log of the current application is customized and needs to be written in a unified format, and this problematic service is an old project before, and it is not written in a unified log format, so such a mess will beThere is a problem with the logs being written together.
Resolution reference
[1] Back up the current log index data, then delete the index data and recreate it, and cancel the services that are not output according to the unified format log into the current index. After processing, the problem is solved, and the log falls into the index normally.It is very rude to delete the index here, because this is only half a day's log data, non-business information, and has been backed up.
[2] If the index cannot be rebuilt, then only the log data record of the corresponding service can be deleted, and then the log is extracted.
[3] Another reason for this problem is that the data from logstash to ES index is dynamically mapped to generate an index (table) structure. If it is data with strict requirements, we can set the index template for our project.The storage of personnel information in the database uses the index template method, which restricts the data format from the index (table) structure.
边栏推荐
猜你喜欢

OpenCV创始人:开源绝不能完全免费!

如何开展性能测试,你知道吗?

ES进阶 数组功能语法新特性详解

google搜索技巧——程序员推荐

测试3年,开口就要25k?面试完最多给15k...
OpenHarmony啃论文俱乐部-啃论文心得
![[4G/5G/6G专题基础-154]: 5G无线准入控制RAC(Radio Admission Control)](/img/5d/5e6cb3e4199c678c06a3b8fab37aa0.png)
[4G/5G/6G专题基础-154]: 5G无线准入控制RAC(Radio Admission Control)

WeChat public account background management

117. 本地开发好的 SAP UI5 应用部署到 ABAP 服务器时,中文字符变成乱码的原因分析和解决方案

ARM development (4) How to read the chip manual for novice Xiaobai, bare metal driver development steps and pure assembly to achieve lighting, assembly combined with c lighting, c to achieve lighting
随机推荐
Oops Framework模板项目新手引导
ES进阶 函数功能语法新特性详解
88Q2110 access C45 phy address through C22
软件测试面试题:缺陷等级应如何划分?
自动生成数据库设计文档利器
①CAS SSO单点登录框架源码深度分析
八.数据的存储
深度学习-第二次
漏洞管理计划的未来趋势
混币器Tornado遭制裁 对DeFi市场意味着什么?
OpenCV创始人:开源绝不能完全免费!
comp3331-9331-21t1-midterm复习
软件测试面试题:单元测试的策略有哪些?
Fatal error in launcher: Unable to create process using xxx --logdir logs(tensorboard使用)
思念家乡的月亮
想进阿里?先来搞懂一下分布式事务
深度学习中的模型设计
Inter-process communication method (2) Named pipe
测试3年,开口就要25k?面试完最多给15k...
comp3331-9331-22t1-midterm复习辅导-tutorial week 5