Tek*_*ath 5 elasticsearch elastic-stack
我在不同的服务器(许多机器)中有网络应用程序的日志。如何在安装了 Elastic search 和 Kibana 的系统中收集这些日志。当我搜索时,我只找到了显示设置的教程,其中logs、logstash、beats和都在一起。elasticsearchkibana
Ish*_*awa 16
由于您有许多产生日志的机器,因此您需要使用 Filebeat、Logstash、Elasticsearch 和 Kibana 设置 ELK 堆栈。
它将监听每台机器中的日志文件并将它们转发到您在filebeat.yml配置文件中提到的logstash实例,如下所示:
#=========================== Filebeat inputs =============================
filebeat.inputs:
- type: log
# Change to true to enable this input configuration.
enabled: true
# Paths that should be crawled and fetched. Glob based paths.
paths:
- /path_to_your_log_1/ELK/your_log1.log
- /path_to_your_log_2/ELK/your_log2.log
#----------------------------- Logstash output --------------------------------
output.logstash:
# The Logstash hosts
hosts: ["private_ip_of_logstash_server:5044"]
Run Code Online (Sandbox Code Playgroud)
Logstash服务器监听端口5044并通过logstash配置文件传输所有日志:
input {
beats { port => 5044 }
}
filter {
# your log filtering logic is here
}
output {
elasticsearch {
hosts => [ "elasticcsearch_server_private_ip:9200" ]
index => "your_idex_name"
}
}
Run Code Online (Sandbox Code Playgroud)在logstash中,您可以过滤日志并将其拆分为字段并将它们发送到elasticsearch。
下面是 ELK 配合 filebeat 的基本架构:

| 归档时间: |
|
| 查看次数: |
14666 次 |
| 最近记录: |