Open freesoft opened 7 years ago
Not sure if it's correct way or relevant, but when I ran screen command something like
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
and then cd /var/lib/docker/containers/
and checked the files, it has log file. However, --max-file and --max-size option doesn't work and the size of log file is keep increasing.
It does create log file and rotate it with given size if I run it with docker-compose. Still original command doesn't work with "docker run" + file configuration in Docker for Mac preference configuration.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
comment.
Stale issues will be closed after an additional 30d of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen
comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
/remove-lifecycle stale
/lifecycle frozen
If I would like to send logs to ElasticStack using FileBeat, what should I do? How should I configure everything?
Hi, any update about the last comment?
Hi, I encountered the same problem - looking for a way getting the logs processed by FileBeat (ELK stack) - how do I do that on a Mac?
Thanks!
Hi, it works using a volume on /var/lib/docker/containers
, in a docker-compose file it looks like:
filebeat:
image: docker.elastic.co/beats/filebeat:6.3.1
user: root
volumes:
- /var/lib/docker/containers:/mnt/log/containers:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
BTW I also mounted /var/run/docker.sock
to configure the Docker autodiscover provider.
Hope it will help you.
Any updates for getting docker container logs processed by filebeat on Mac?
Any updates for getting docker container logs processed by filebeat on Mac?
See the comment by @mremi. It works!
See the comment by @mremi. It works!
That only works if there are log files in the folder. I think the main issue is there are no log files in that folder. For me the /var/lib/docker/containers folder doesn't even exist.
any updates to the original issue ? "/var/lib/docker/containers folder doesn't even exist. ". I am running docker Linux containers in Win 10.
You can see it after getting a shell to the VM like this for instance:
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
linuxkit-025000000001:~# ls -lsa /var/lib/docker/containers
total 24
16 drwx------ 3 root root 16384 Feb 4 09:30 .
4 drwx--x--x 15 root root 4096 Apr 18 12:57 ..
4 drwx------ 5 root root 4096 Apr 18 12:57 0ab1ed1132dcdcc4441a84942dc6b634cbbccf28a26e6e432b6f5c04a230e6bc
4 years later, still happens on Apple M1
~/ docker inspect --format="{{.LogPath}}" hix-cms 12s
/var/lib/docker/containers/16c69bf170c30ced73bf5541159fea687a54d40c3a4ece6b1e1d8bff08682774/16c69bf170c30ced73bf5541159fea687a54d40c3a4ece6b1e1d8bff08682774-json.log
~/ ls -altrh /var/lib/ 0s
total 0
drwx------ 2 _postfix wheel 64B Oct 13 08:06 postfix
drwxr-xr-x 3 root wheel 96B Oct 13 08:06 .
drwxr-xr-x 34 root wheel 1.1K Mar 14 12:41 ..
Please, fix it.
Expected behavior
When docker inspect for running container, I'm expecting a log file (json-format by default) to be located at wherever "logPath" in docker inspect result.
Actual behavior
However, Docker for Mac does not create a directory and files. It's like /var/lib/docker/containers/, but there is no /var/lib/docker directory and/or its subdirectory containers. Even if I create /var/lib/docker/containers and run docker container, it does NOT log anything or create log file.
Information
Docker for Mac: version: 17.07.0-ce-rc4-mac25 (69202b202f497d4b6e627c3370781b9e4b51ec78) macOS: version 10.12.6 (build: 16G29) logs: /tmp/CDB19F64-B377-4F4F-BE50-C2E5EA91C19B/20170824-112848.tar.gz [OK] db.git [OK] vmnetd [OK] dns [OK] driver.amd64-linux [OK] virtualization VT-X [OK] app [OK] moby [OK] system [OK] moby-syslog [OK] db [OK] env [OK] virtualization kern.hv_support [OK] slirp [OK] osxfs [OK] moby-console [OK] logs [OK] docker-cli [OK] menubar [OK] disk
Steps to reproduce the behavior