在CentOS上优化Filebeat的日志存储可以通过以下几种方法实现:
配置优化:
multiline.pattern
、multiline.match
和 multiline.max_lines
等参数,以正确处理多行日志。json.keys_under_root
为 true
,json.overwrite_keys
为 true
,json.message_key
为 log
,json.add_error_key
为 true
,以便更好地处理JSON格式日志。queue.type
设置为 persisted
,并配置 queue.max_bytes
和 flush.min_events
等参数,以确保数据不会丢失。ignore_older
参数忽略长时间未修改的日志文件,避免不必要的处理。close_inactive
参数设置不活跃文件关闭时间,释放资源。性能优化:
harvester_limit
参数限制每个input并行启动的harvester数量,避免资源过度占用。bulk_max_size
参数,启用批量输出,提高发送效率。监控与调优:
通过上述优化措施,可以显著提升Filebeat在CentOS上的稳定性和性能。