当前位置:网站首页>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.
边栏推荐
- Detailed explanation of common methods of filtering matrix (array) elements in Matlab
- MySQL八股文背诵版(续)
- ES进阶 数组功能语法新特性详解
- Experiment record of Shengxin (part3)--scipy.spatial.distance_matrix
- Mask RCNN 网络详解
- 0图中等 LeetCode565. 数组嵌套
- SIT221 Data Structures and Algorithms课程辅导
- MySQL权限控制、分区表、快速复制表
- Ora - 00001 in violation of the only constraint
- How to solve the problem of Tomcat booting and crashing
猜你喜欢
随机推荐
MySQL Basics [Part 1] | Database Overview and Data Preparation, Common Commands, Viewing Table Structure Steps
软件测试面试题:谈谈你对 cmm 和 is9000 的认识?
117. 本地开发好的 SAP UI5 应用部署到 ABAP 服务器时,中文字符变成乱码的原因分析和解决方案
LitePal操作数据库
【备战“金九银十”】2022年软件测试面试题最新汇总
[Detailed explanation of C data storage] (1) - in-depth analysis of the storage of shaping data in memory
Please talk about for...in and for...of in JS (below)
shell [stdin/stdout/stderr][重定向]
微信公众号后台管理
Inter-process communication method (2) Named pipe
Mysql_Note5
Mysq_Note4
JVM类加载机制
gRPC基础概念:闭包
隐私计算融合应用研究
软件测试面试题:什么是α测试,β测试?
gRPC闭包调度器
深度学习中的模型设计
Engineering Design of Single-sided PCB Routing Impedance
基于FPGA状态机的自动售货机功能实现

![Deep Learning [Chapter 2]](/img/09/5eb16731c3c47965da131c2aa0c2c3.png)







