Hi!
I'm running Filebeat as a Docker container. I bind-mount a config file "filebeat.yml" that defines logging to files, but the logs still end up in the console, not in a file.
The config file is being read (other config values are picked up fine, e.g. "logging.json: true"). The syntax seems to be fine (filebeat test config returns OK), and the values seem to be fine too (filebeat export config output looks fine).
When I run those two commands (filebeat test config and filebeat export config), I do this by entering into the container (docker exec -it mycont /bin/bash) and running the filebeat command from command line in there. Funny enough, those two tests write logs at the locations I specify, so the locations are picked up fine, and the permissions seems to be fine:
# No logfile yet:
bash-4.2$ ls -lpah ./logs
total 4.0K
drwxrwx---. 2 root filebeat 6 Aug 17 22:30 ./
drwxr-x---. 8 root filebeat 4.0K Aug 17 22:30 ../
# Test config:
bash-4.2$ ./filebeat test config
Config OK
# Now a logfile is there:
bash-4.2$ ls -lpah ./logs
total 8.0K
drwxrwx---. 2 root filebeat 30 Sep 4 13:48 ./
drwxr-x---. 8 root filebeat 4.0K Aug 17 22:30 ../
-rw-r--r--. 1 filebeat filebeat 3.6K Sep 4 13:48 this_name_please
# Export config:
bash-4.2$ ./filebeat export config
filebeat:
[...]
# Now, a second logfile was created:
bash-4.2$ ls -lpah ./logs
total 12K
drwxrwx---. 2 root filebeat 56 Sep 4 13:48 ./
drwxr-x---. 8 root filebeat 4.0K Aug 17 22:30 ../
-rw-r--r--. 1 filebeat filebeat 564 Sep 4 13:48 this_name_please
-rw-r--r--. 1 filebeat filebeat 3.6K Sep 4 13:48 this_name_please.1
So the difference seems to be whether filebeat is run inside the container manually by user "filebeat", or whether it is run by being launched through docker-compose up.
Hi,
good point. I checked it again, and you are right, it is "permissions: 436" (that should be r---wxrw-, right?) in the exported, and "0664" (rw-rw-r--) in the .yml file.
But the other values (e.g. logging.level, logging.metrics.enabled, logging.files.path) are picked up fine, so I do not have an explanation.
I think I have copied this from some examples, I have not really given those permissions much thought as of yet. But as they apply to the permissions of the resulting log files, I did not think that they'd cause my problem.
(Funny enough, the created log file in the container has rw-r--r-- (0644), which is neither the given value, nor the exported value, nor the default value 0600 (https://www.elastic.co/guide/en/beats/filebeat/current/configuration-logging.html). But I have played a bit with the config since I asked the question, but I can start up a clean example if this is relevant.)
Good morning!
I have set the permissions to default now. The volume where the logs should be written in is not mounted from the host, but the default directory inside the container. So it should work, as I have not touched anything.
I can reproduce this locally myself (on 6.4.1), also seems to be ignoring logging.level which is weird. I have the log level set to warning below, but I still get info logs. In addition, logs go to stdout instead of the to_files destination.
Hi! Thanks for the suggestion! I'll try to see if that does the trick.
But would there be a way to switch off that flag withouth having to rebuild the image? I like using the original images and not build custom ones, especially if it is for such a small change.
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.