Closed iangkent closed 9 years ago
Hmm, can you try with 2k
instead of 2K
? The values are passed straight through to the Docker Remote API, and the documentation for logging driver options reads:
--log-opt max-size=[0-9+][k|m|g]
And I'm not sure it accepts their uppercase counterparts.
The problem was not with max-size. The problem is with max-file. I needed to put the number in quotes.
log_opt:
max-size: 1M
max-file: '2'
Yep, I just looked at the Docker daemon code, and it expects a string... which it then promptly converts to an integer: https://github.com/docker/docker/blob/3856c5efa685013b5e82347d5812de4c7788d4ff/daemon/logger/jsonfilelog/jsonfilelog.go#L73
Quite sad that it does not accept an integer, but looking at the way the logging drivers configs are built in Docker it (sort of) makes sense. I'll make a fix to Maestro to make sure that all log_opt
key/value pairs are string/string pairs.
trying to follow up, but is seems logging config is not effective:
busybox:
image: busybox
instances:
busybox1:
ship: test
log_driver: json-file
log_opt:
max-size: 1M
max-file: '2'
command:
- "sh"
- "-c"
- "while true; do sleep 0.1; echo `date` - logmessage; done"
however
j4care@dev:/tmp$ docker inspect busybox | grep Log
.. in comparison
j4care@dev:/tmp$ docker run --log-opt max-size=1k --log-opt max-file=2 --rm -d busybox sh -c "while true; do sleep 0.1; echo logmessage; done"
...
j4care@dev:/tmp$ docker inspect youthful_khayyam | grep Log
"LogPath": "/var/lib/docker/containers/c6937b44f2f79eadfbd7a937c065fc02c0166cd2246fa658fdf6fe5a9f45969a/c6937b44f2f79eadfbd7a937c065fc02c0166cd2246fa658fdf6fe5a9f45969a-json.log",
"LogConfig": {
what am I doing wrong?
I have read the docs for maestro-ng stating that it supports ability to configure log driver. I tried this out and got exception. If I put the max-file value in quotes it works.