I'm using running Filebeat version 7.10.0 as container version to ship docker container logs as well as system logs directly to Elasticsearch. Docker logs are shipped fine but system logs are not getting shipped. When I deploy them again, sometimes they are shipped but most of the times they are not shipped. Can anyone please help me about this weird behaviour of Filebeat?
Also is this related to folder permission issue? What is the expected permission to give to folder so that logs can be shipped? Any help would be appreciated!
As a reminder please do not directly tag me. This will be the last time I respond to that. I think you need to continue to learn more about docker...
Remember all paths in the filebeat.yml are "Inside / Relative" to the docker container not the host it is running on... to read from the host you must mount the volume...
I suspect your problem is that you did not mount the host syslog directory as a volume to your docker container thus you were just trying to read syslog from within the docker container...
@stephenb - Thanks a ton! I had mounted the syslog path in my docker-compose file but in the filebeat.yml gave the host path instead of docker container path. I updated it and now I'm getting the logs. You saved me from dying, I was figuring out the issue since a long time but couldn't get the answer.
Also i'm sending logs directly to Elasticsearch. Earlier we were using Logstash for log parsing and aggregation but since it was consuming space and resources on our production systems so we removed the logstash container. Is there any drawback of sending logs directly to Elasticsearch via Filebeat? Any delay/buffer in sending the logs? My understanding of Logstash container is for advance filtering. dynamic index naming and log aggregation. (Please correct me if I'm wrong)
One last thing, in my Kibana console I'm always getting the unassigned shards issue. So I did these settings in Kibana console but nothing is working. At that moment when I apply the setting I'm getting the zero unassigned shards but after a while the problem comes again. Can you please take a look at this what I'm missing?
And thanks again! You literally saved me again and aplogies for tagging you directly.
PUT /_cluster/settings
{"transient":{"cluster.max_shards_per_node":2000}}
PUT /*/_settings
{
"index" : {
"number_of_replicas":0,
"auto_expand_replicas": false
}
}
PUT /_cluster/settings
{
"transient" : {
"cluster.routing.allocation.enable" : "all"
}
}
If you want 0 replicas ... you will need to change the templates, I suspect every new index is getting assigned 1 replica because that is how it is defined in the filebeat template.
Of course with 1 node and 0 replicas you are at risk of data loss.
Putting Max Shards per node to 2000 is a bad bad bad idea your node will not work well, if you have 30GB Heap 600 Shards Max ... 20 Max Shards per 1 GB heap.
Filebeat vs Logstash there are pros and cons to each and depends on many things
Filebeat to Elasticsearch is perfectly fine... should not introduce delay, I have no clue of the of your volume etc
And since I was suffering from unassigned shards and ElasticsearchError error="400 - Rejected by Elasticsearch [error type]: validation_exception [reason]: 'Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [2000]/[2000] maximum shards open
the solution on various forums was to set the number of replicas to 0.
Can you please suggest me what to do as I face these 2 Elasticsearch errors very frequently. This is impacting the production servers.
In short I think you need to learn a little bit more about how Elasticsearch works, There is free training on our site.
It seems that you're just trying whatever setting you read from a topic or stack overflow That's probably not going to get you where you want to get..
4 GB heap means you should not have more than 80 shards maybe a 100 if you're pushing it on your single 4GB of heap node.. 2000 is massively wrong.
So in short your Elasticsearch
maybe undersized undersized And I suspect your Also creating very many tiny indexes and shards which is very unefficient. The proper sizing is a combination of how much it ingests how much it's queried how many shards etc 4GB will work if you have the proper shard sizing and reasonable CPU for the ingest and query.
Setting the max shard count to 2000 does not mean the node can actually handle it in fact you're actually making it worse.
What you need to do is read the docs about how should I size my shard and nodes You are way off with respect to the size of node you need or the number of shards or how to manage the indexes.
In short you need to manage your shard count You are what's known as extremely oversharded.
The number of shards that can be used on a node is not infinite amount on a node and with 4GB I'm surprised it's even working for you.
Please read a little bit more and take some training I can't solve all these through discuss.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.