简体   繁体   中英

Not able to send log to logstash in another server using logstash-logger gem

I am using rails 5.2.1 and ruby 2.5.0. I have included the following in the environment file

 config.logstash = [
 {
        type: :tcp,
        port: 5044,
        host: 'log server ip addrees',
        verify_hostname: false
  }
]

in Gemfile

gem "lograge"
gem "logstash-event"
gem 'logstash-logger'

Then I have opened the inbound port 5044 of log server and outbound port for the app server. But is showing the error

[LogStashLogger::Device::TCP] Errno::EPIPE - Broken pipe

I have installed elk stack in log server to receive logs from stg and dev server. But currently is getting the above error.

I also have another doubt, if it succeed then how can I identify from which server(stg or prod) the log came?

I have solved the issue by writing the log to a file. Then use an application firebeat to send the Json file to the logstash server. It will send the new logs to the 5044 port of logstash server which is read by the sever. In filebeat, I am setting a variable as prod, stg corresponding to each server to identify the server in logstash configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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