简体   繁体   English

无法将Filebeat连接到Logstash以使用ELK进行日志记录

[英]Unable to connect Filebeat to logstash for logging using ELK

Hi I've been working on a automated logging using elastic stack. 嗨,我一直在使用弹性堆栈进行自动日志记录。 I have filebeat that is reading logs from the path and output is set to logstash over the port 5044 . 我的文件filebeat正在从路径读取日志,并且输出设置为通过端口5044进行logstash。 The logstash config has an input listening to 5044 and output pushing to localhost:9200. logstash配置的输入监听5044 ,输出推送到localhost:9200。 The issue is I can't get it to work, I have no idea what's happening. 问题是我无法正常工作,不知道发生了什么。 Below are the files: 以下是文件:

My filebeat.yml path: etc/filebeat/filebeat.yml 我的filebeat.yml路径: etc/filebeat/filebeat.yml

#=========================== Filebeat prospectors =============================

filebeat.prospectors:

# Each - is a prospector. Most options can be set at the prospector level, so
# you can use different prospectors for various configurations.
# Below are the prospector specific configurations.

- input_type: log

# Paths that should be crawled and fetched. Glob based paths.
paths:
- /mnt/vol1/autosuggest/logs/*.log
#- c:\programdata\elasticsearch\logs\*
<other commented stuff>
#----------------------------- Logstash output --------------------------------
output.logstash:
# The Logstash hosts
hosts: ["10.10.XX.XX:5044"]

# Optional SSL. By default is off.
<other commented stuff>

My logstash.yml path: etc/logstash/logstash.yml 我的logstash.yml路径: etc/logstash/logstash.yml

<other commented stuff>
path.data: /var/lib/logstash
<other commented stuff>
path.config: /etc/logstash/conf.d
<other commented stuff>

# ------------ Metrics Settings --------------
#
# Bind address for the metrics REST endpoint
#
http.host: "10.10.XX.XX"
#
# Bind port for the metrics REST endpoint, this option also accept a range
# (9600-9700) and logstash will pick up the first available ports.
#
# http.port: 9600-9700
<other commented stuff>
path.logs: /var/log/logstash
<other commented stuff>

My logpipeline30aug.config file path: /usr/share/logstash 我的logpipeline30aug.config文件路径: /usr/share/logstash

input {
  beats {
  port => 5044
  }
}

filter {
  grok {
match => { "message" => "\A%{TIMESTAMP_ISO8601:timestamp}%{SPACE}%{WORD:var0}%{SPACE}%{NOTSPACE}%{SPACE}(?<searchinfo>[^#]*)#(?<username>[^#]*)#(?<searchQuery>[^#]*)#(?<latitude>[^#]*)#(?<longitude>[^#]*)#(?<client_ip>[^#]*)#(?<responseTime>[^#]*)" }
  }
}

output {
   elasticsearch {
      hosts => ["http://localhost:9200"]
      index => "logstash30aug2017"
      document_type => "log"
   }
}

Please Note: Elasticsearch, logstash, filebeat are all installed on the same machine with ip: 10.10.XX.XX and I've checked the firewall, it's not the issue for sure. 请注意: Elasticsearch,logstash,filebeat都安装在同一台机器上,其IP地址为: 10.10.XX.XX并且我已经检查了防火墙,确定不是问题所在。

I checked that logstash, filebeat services are all running. 我检查了logstash,filebeat服务是否都在运行。 Filebeat is able to push the data to elasticsearch when configured so and logstash is able to push the data to elasticsearch when configured so. 配置时,Filebeat能够将数据推送到elasticsearch,logstash能够将数据推送到elasticsearch。


Maybe it's how I am executing the process is the issue.. I do a bin/logstash -f logpipeline30aug.config in /usr/share/logstash to start it and then I do a /etc/init.d/filebeat start from the root directory. 也许这就是我执行该过程的方式。.我在/usr/share/logstash执行bin/logstash -f logpipeline30aug.config /usr/share/logstash来启动它,然后从/etc/init.d/filebeat start根目录。

Please Note: Formatting may be effected due to stackoverflow formatting issue 请注意:由于stackoverflow格式化问题,格式化可能会受到影响

Can someone please help? 有人可以帮忙吗? I've been trying everything since 3 days now, I've gone through the documentations as well 从三天以来我一直在尝试所有事情,我也阅读了文档

Your filebeat.yml looks invalid. 您的filebeat.yml看起来无效。

The output section lacks an indentation: 输出部分缺少缩进:

output.logstash:
  hosts: ["10.10.XX.XX:5044"]

In general, check the correctness of the config files to ensure they're ok. 通常,请检查配置文件的正确性以确保它们正常。

For instance, for filebeat, you can run: 例如,对于文件拍,可以运行:

filebeat -c /etc/filebeat/filebeat.yml -configtest

If you have any errors it explains what is that error so you can fix it. 如果有任何错误,它将说明该错误是什么,因此您可以修复它。

You can use a similar approach for other ELK services as well 您也可以对其他ELK服务使用类似的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM