Filebeat - Multiple server instance configuration - elasticsearch

I did configure the Elastic Stack (Logstash + Elastic search + Kibana ) with filebeat. So my question is I have multiple servers where I deployed my application instances (Microservices applications ). I want to capture logs from all the servers but for that I have to install filebeat in each server. Is it the correct understanding ? or Can we configure something like that single filebeat instance able to fetch logs from all the servers (Servers can be same network) and send logs over TCP or any protocol ?

Yes you will have to deploy filebeat on all the servers from where you wish to scrap the logs.

Another option is to configure your logstash to listen on a TCP port and then configure your applications to log to a socket instead of a file.
input {
tcp {
port => 8192
codec => json
tags => [ "micrologs" ]
}
}
This sets up a listener on the Logstash box on port 8192. Logs arrive one at a time, with a connection each time, formatted in JSON.
input {
tcp {
port => 8192
codec => json_lines
tags => [ "micrologs" ]
}
}
This does the same, except the connection is persistent, and the json_lines codec is used to break up log-events based on the lines of JSON in the incoming connection.
You don't have to use json here, it can be plain text if you need it. I used JSON as an example of structured log.

Related

Forward firewall logs from kiwi syslog server to elasticsearch?

I have setup the Kiwi Syslog Server where I'm collecting the Sonicwalls Firewall traffic logs, but I want to access that logs through any API or want to send on elasticsearch. Is there any way to setup the logstash and elasticsearch to collect firewall logs from the kiwi syslog server where we are collecting the logs?
In my opinion you have two options
let Logstash read txt file output of the kiwi syslog server
This will be the option if you do other things with the syslogs then sending them to Elasticsearch
Use the Logstash Syslog input and have Logstash listen for syslog events, process them and send them to Elasticsearch [Info on the Logstash Syslog input can be found here]
This implies you get rid of Kiwi
You can't send directly to elasticsearch, but you can configure Kiwi to forward the logs to another place, if you configure logstash to receive this log you can then send it to elasticsearch.
You can use the udp, tcp or syslog input to do this, the main difference is that using the syslog input it will help with the parsing, but the syslog message must follows the format specified in the RFC, I'm not sure if this is the case with Kiwi.
To use the syslog input you just need a configuration like this one.
input {
syslog {
port => "port-to-listen-to"
}
}
output {
elasticsearch {
your-elasticsearch-output
}
}

using filebeat with old version of logstash

I should send my logs to a logstash instance.
Unfortunately it's running a very old instance of logstash (that does not support beats input).
It has a normal tcp input like
tcp {
port => 8888
codec => "json"
}
This is the current configuration of filebeat
output.logastash:
hosts: ["${LOGSTASH_HOST}:8888"]
Is there a way to configure filebeat so its output is accepted by logstash's tcp input?
No, filebeat outputs using the beats protocol and will not work with a tcp input.
You have some options of how to work around this problem.
Upgrade Logstash: before I recommend any hacks or use of deprecated software, the best option is simply upgrading logstash to a modern version, there have been very few breaking changes and a lot of performance upgrades.
Manually add the beats input to Logstash: You can add the beats input to logstash 2.x with /opt/logstash/bin/logstash-plugin install logstash-input-beats
Use logstash-forwarder: Filebeats' predecessor logstash-forwarder is deprecated, but would work with the lumberjack input of older logstashes
Use an intermediary: If we look at the output options supported by filebeat and the inputs supported by Logstash >=1.5 you could use kafka or redis in between filebeat and logstash which they would both be compatible with.

Logstash input using proxy

I'm having a little trouble while using Logstash and http_poller as an input plugin. I would like to send my http requests through a proxy, but the only documentation I could find is:
<li> Value type is <<string,string>>
* There is no default value for this setting.
How can I define the IP of my proxy and a specific port to use?
After a few weeks of research, I found the solution:
You just have to specify the host/port within brackets;
proxy => {
host => "IP"
port => "PORT"
}

Specific logging with rsyslog and ELK

I have an rsyslog server and ELK stack running on the same server.
Our application is forwarding logs to rsyslog and is forwarding it to localhost.
We now want to split up our logging (frontend and backend logging).
Our frontend dev has added a tag [frontend] that will be added to the message.
Is it possible to filter this out in rsyslog and forward this to another logstash while keeping the backend logging?
i have this in my configuration at the moment but it keeps forwarding all messages to that logstash:
*.* ##localhost:5555
:msg, contains, "\[frontend\]" stop
*.* ##localhost:5544
:programname, contains, "backend" ~
We are sending the frontend logs through the backend so program name 'backend' is in every message we receive
did some more research and found a working solution:
*.* {
:msg, contains, "\[frontend\]"
##localhost:5555
}
*.* {:programname, contains, "backend"
##localhost:5544
stop
}

Can fluentd replace rsyslog?

Can fluentd replace rsyslog to centralize logs?
I want to centralize my logs (comming from syslog on 514 UDP port) in files like <host>.log.
Can fluentd do this job?
If you want to retrieve records via the syslog protocol on UDP or TCP,
you can use syslog input plugin for fluentd.
in_syslog is included in Fluentd’s core, so you probably already have it.

Resources