听到是我的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_frequency,但是elasticsearch无法更快地获取日志
如何立即在Elasticsearch中获取日志?
请帮助我。.
答案 0 :(得分:1)
elasticsearch中永远不会有“即时”可用的日志行。需要监视文件的大量更改或时间,然后需要在批量请求中将新添加的行发送到elasticsearch并索引到正确群集节点上的适当分片中。网络延迟,TLS,身份验证+授权,并发写入/搜索负载:所有这些因素都会影响“即时”体验。
日志获取和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的批量大小)并监视摄取速度。对于每种群集配置,都有不同的最佳设置。output.elasticsarch.workers
(默认为1)close_inactive
和scan_frequency
值。指定更合适的backoff
将影响Filebeat检查文件更新的积极程度。