如何在filebeat中即时推送日志到elasticsearch?
How to push logs to elasticsearch in filebeat instantly?
听说是我的filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- ../typescript/rate-limit-test/logs/*.log
json.message_key: "message"
json.keys_under_root: true
json.overwrite_keys: true
scan_frequency: 1s
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 1
logging.level: debug
output.elasticsearch:
hosts: ["34.97.108.113:9200"]
index: "filebeat-%{+yyyy-MM-dd}"
setup.template:
name: 'filebeat'
pattern: 'filebeat-*'
enabled: true
setup.template.overwrite: true
setup.template.append_fields:
- name: time
type: date
processors:
- drop_fields:
fields: ["agent","host","ecs","input","log"]
setup.ilm.enabled: false`
我更改了 scan_frequncy 但 elasticsearch 无法更快地获取日志
如何在 elasticsearch 中即时获取日志?
请帮帮我..
elasticsearch 中永远不会有 'instantly' 可用的日志行。需要监视文件的大量更改或时间,然后新添加的行需要在批量请求中发送到 elasticsearch,并索引到正确集群节点上的适当分片中。网络延迟、TLS、身份验证 + 授权、并发 write/search 负载:所有这些都会影响 'instantly' 体验。
日志摄取和 NRT(近实时搜索)的速度取决于许多因素以及 elasticsearch 和 filebeat 中的配置选项。
关于调整 elasticsearch 以提高索引速度,请查看 this documentation,并应用您尚未了解的内容。简要概述:
- 禁用交换并启用内存锁定(
bootstrap.memory_lock: true
)
- 考虑减少索引的
index.refresh_interval
(默认为 1s)以便更频繁地刷新文档(在集群中产生更多 IO)
对于 Filebeat,there is also good documentation about tuning,但一般来说,我看到以下选项:
- 尝试不同的
output.elasticsarch.bulk_max_size
值(默认批量大小为 50)并监控摄取速度。对于每个集群配置,都有不同的最佳设置。
- 在高负载场景下,日志写入速度快时,考虑增加worker数量
output.elasticsarch.workers
(默认为1)
- 在相反的情况下,只写入几行日志,请考虑增加收割机的
close_inactive
and scan_frequency
值。指定更合适的 backoff
将影响 Filebeat 检查文件更新的积极程度。
听说是我的filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- ../typescript/rate-limit-test/logs/*.log
json.message_key: "message"
json.keys_under_root: true
json.overwrite_keys: true
scan_frequency: 1s
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 1
logging.level: debug
output.elasticsearch:
hosts: ["34.97.108.113:9200"]
index: "filebeat-%{+yyyy-MM-dd}"
setup.template:
name: 'filebeat'
pattern: 'filebeat-*'
enabled: true
setup.template.overwrite: true
setup.template.append_fields:
- name: time
type: date
processors:
- drop_fields:
fields: ["agent","host","ecs","input","log"]
setup.ilm.enabled: false`
我更改了 scan_frequncy 但 elasticsearch 无法更快地获取日志
如何在 elasticsearch 中即时获取日志?
请帮帮我..
elasticsearch 中永远不会有 'instantly' 可用的日志行。需要监视文件的大量更改或时间,然后新添加的行需要在批量请求中发送到 elasticsearch,并索引到正确集群节点上的适当分片中。网络延迟、TLS、身份验证 + 授权、并发 write/search 负载:所有这些都会影响 'instantly' 体验。
日志摄取和 NRT(近实时搜索)的速度取决于许多因素以及 elasticsearch 和 filebeat 中的配置选项。
关于调整 elasticsearch 以提高索引速度,请查看 this documentation,并应用您尚未了解的内容。简要概述:
- 禁用交换并启用内存锁定(
bootstrap.memory_lock: true
) - 考虑减少索引的
index.refresh_interval
(默认为 1s)以便更频繁地刷新文档(在集群中产生更多 IO)
对于 Filebeat,there is also good documentation about tuning,但一般来说,我看到以下选项:
- 尝试不同的
output.elasticsarch.bulk_max_size
值(默认批量大小为 50)并监控摄取速度。对于每个集群配置,都有不同的最佳设置。 - 在高负载场景下,日志写入速度快时,考虑增加worker数量
output.elasticsarch.workers
(默认为1) - 在相反的情况下,只写入几行日志,请考虑增加收割机的
close_inactive
andscan_frequency
值。指定更合适的backoff
将影响 Filebeat 检查文件更新的积极程度。