How to get logs from Docker with journald driver?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
OpenSuse Tumbleweed + Docker 17.04. I created /etc/docker/daemon.json with:
"log-driver": "journald",
"log-opts":
"labels": "my_test",
"env": "os,customer"
Then I started docker daemon: systemctl start docker. Checked it: sudo docker info|grep Logg and see journald as current default driver. Also sudo docker inspect -f '.HostConfig.LogConfig.Type' MY-CONTAINER-ID shows me journald again. Docker was run as
sudo docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup --tmpfs /run/dbus --tmpfs /run/lock --cap-add=ALL MY-CONTAINER
and then I SH-ed to it. In Docker I made several log-messages with:
logger XXX
logger -p local0.notice XXX
# etc...
I'm see these messages in Docker journald with journalctl -n ....
And I supposed that I'll find those log-messages in the container ("host OS") too: with journalctl -n ... - nothing. With docker logs MY-CONTAINER-ID - nothing too. I want to log messages from Docker to container ("host") journald. Configuration looks right, but log messages are missing. Would somebody help me - what is wrong with Docker on OpenSuse/with my configuration?
systemd logs opensuse docker systemd-journald
add a comment |Â
up vote
0
down vote
favorite
OpenSuse Tumbleweed + Docker 17.04. I created /etc/docker/daemon.json with:
"log-driver": "journald",
"log-opts":
"labels": "my_test",
"env": "os,customer"
Then I started docker daemon: systemctl start docker. Checked it: sudo docker info|grep Logg and see journald as current default driver. Also sudo docker inspect -f '.HostConfig.LogConfig.Type' MY-CONTAINER-ID shows me journald again. Docker was run as
sudo docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup --tmpfs /run/dbus --tmpfs /run/lock --cap-add=ALL MY-CONTAINER
and then I SH-ed to it. In Docker I made several log-messages with:
logger XXX
logger -p local0.notice XXX
# etc...
I'm see these messages in Docker journald with journalctl -n ....
And I supposed that I'll find those log-messages in the container ("host OS") too: with journalctl -n ... - nothing. With docker logs MY-CONTAINER-ID - nothing too. I want to log messages from Docker to container ("host") journald. Configuration looks right, but log messages are missing. Would somebody help me - what is wrong with Docker on OpenSuse/with my configuration?
systemd logs opensuse docker systemd-journald
Hmm, I added-v /dev/log:/dev/logand it seems to work now, so question is - is it dirty hack or Docker documentation lacks this mandatory mount-point?
â Paul-AG
Nov 6 '17 at 16:15
seems that it's workaround only
â Paul-AG
Nov 6 '17 at 17:20
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
OpenSuse Tumbleweed + Docker 17.04. I created /etc/docker/daemon.json with:
"log-driver": "journald",
"log-opts":
"labels": "my_test",
"env": "os,customer"
Then I started docker daemon: systemctl start docker. Checked it: sudo docker info|grep Logg and see journald as current default driver. Also sudo docker inspect -f '.HostConfig.LogConfig.Type' MY-CONTAINER-ID shows me journald again. Docker was run as
sudo docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup --tmpfs /run/dbus --tmpfs /run/lock --cap-add=ALL MY-CONTAINER
and then I SH-ed to it. In Docker I made several log-messages with:
logger XXX
logger -p local0.notice XXX
# etc...
I'm see these messages in Docker journald with journalctl -n ....
And I supposed that I'll find those log-messages in the container ("host OS") too: with journalctl -n ... - nothing. With docker logs MY-CONTAINER-ID - nothing too. I want to log messages from Docker to container ("host") journald. Configuration looks right, but log messages are missing. Would somebody help me - what is wrong with Docker on OpenSuse/with my configuration?
systemd logs opensuse docker systemd-journald
OpenSuse Tumbleweed + Docker 17.04. I created /etc/docker/daemon.json with:
"log-driver": "journald",
"log-opts":
"labels": "my_test",
"env": "os,customer"
Then I started docker daemon: systemctl start docker. Checked it: sudo docker info|grep Logg and see journald as current default driver. Also sudo docker inspect -f '.HostConfig.LogConfig.Type' MY-CONTAINER-ID shows me journald again. Docker was run as
sudo docker run -ti -v /sys/fs/cgroup:/sys/fs/cgroup --tmpfs /run/dbus --tmpfs /run/lock --cap-add=ALL MY-CONTAINER
and then I SH-ed to it. In Docker I made several log-messages with:
logger XXX
logger -p local0.notice XXX
# etc...
I'm see these messages in Docker journald with journalctl -n ....
And I supposed that I'll find those log-messages in the container ("host OS") too: with journalctl -n ... - nothing. With docker logs MY-CONTAINER-ID - nothing too. I want to log messages from Docker to container ("host") journald. Configuration looks right, but log messages are missing. Would somebody help me - what is wrong with Docker on OpenSuse/with my configuration?
systemd logs opensuse docker systemd-journald
asked Nov 6 '17 at 15:34
Paul-AG
101
101
Hmm, I added-v /dev/log:/dev/logand it seems to work now, so question is - is it dirty hack or Docker documentation lacks this mandatory mount-point?
â Paul-AG
Nov 6 '17 at 16:15
seems that it's workaround only
â Paul-AG
Nov 6 '17 at 17:20
add a comment |Â
Hmm, I added-v /dev/log:/dev/logand it seems to work now, so question is - is it dirty hack or Docker documentation lacks this mandatory mount-point?
â Paul-AG
Nov 6 '17 at 16:15
seems that it's workaround only
â Paul-AG
Nov 6 '17 at 17:20
Hmm, I added
-v /dev/log:/dev/log and it seems to work now, so question is - is it dirty hack or Docker documentation lacks this mandatory mount-point?â Paul-AG
Nov 6 '17 at 16:15
Hmm, I added
-v /dev/log:/dev/log and it seems to work now, so question is - is it dirty hack or Docker documentation lacks this mandatory mount-point?â Paul-AG
Nov 6 '17 at 16:15
seems that it's workaround only
â Paul-AG
Nov 6 '17 at 17:20
seems that it's workaround only
â Paul-AG
Nov 6 '17 at 17:20
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
docker journald driver captures the stdout and stderr of the container process.
On the other hand, logger command sends a messase to /dev/log.
Edit
It would be nice to do logger -s
My container process starts by cron, so no stdout/stderr. Loggins happens through Haskell logging library, but without Docker I see log-messages in systemd journal.
â Paul-AG
Nov 8 '17 at 10:39
It depends on your logging library setting. If it is configured to emit a log to journald, use -v /run/systemd/journal/socket:/run/systemd/journal/socket . If it is configured to emit a log to syslog , use -v /dev/log:/dev/log . If it is configured.to emit a log to stderr, docker log driver has to capture it.
â takaomag
Nov 8 '17 at 12:26
Seems that -v /dev/log works. But what does log driver journald in this case?! Nothing? First, I supposed that this magic log-driver does all work and I don't need to mount socket or log storage from the host...
â Paul-AG
Nov 8 '17 at 13:05
What docker log driver does is just to capture stdout and stderr of a continered process. No magic! If your containered process emits a log only to syslog, docker log driver captures no log.
â takaomag
Nov 8 '17 at 13:26
One suggestion. If your process is haskell, logging-facade-journald may help you, though I do not know haskell well. github.com/sol/logging-facade/blob/master/README.md
â takaomag
Nov 8 '17 at 13:31
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
docker journald driver captures the stdout and stderr of the container process.
On the other hand, logger command sends a messase to /dev/log.
Edit
It would be nice to do logger -s
My container process starts by cron, so no stdout/stderr. Loggins happens through Haskell logging library, but without Docker I see log-messages in systemd journal.
â Paul-AG
Nov 8 '17 at 10:39
It depends on your logging library setting. If it is configured to emit a log to journald, use -v /run/systemd/journal/socket:/run/systemd/journal/socket . If it is configured to emit a log to syslog , use -v /dev/log:/dev/log . If it is configured.to emit a log to stderr, docker log driver has to capture it.
â takaomag
Nov 8 '17 at 12:26
Seems that -v /dev/log works. But what does log driver journald in this case?! Nothing? First, I supposed that this magic log-driver does all work and I don't need to mount socket or log storage from the host...
â Paul-AG
Nov 8 '17 at 13:05
What docker log driver does is just to capture stdout and stderr of a continered process. No magic! If your containered process emits a log only to syslog, docker log driver captures no log.
â takaomag
Nov 8 '17 at 13:26
One suggestion. If your process is haskell, logging-facade-journald may help you, though I do not know haskell well. github.com/sol/logging-facade/blob/master/README.md
â takaomag
Nov 8 '17 at 13:31
 |Â
show 1 more comment
up vote
1
down vote
docker journald driver captures the stdout and stderr of the container process.
On the other hand, logger command sends a messase to /dev/log.
Edit
It would be nice to do logger -s
My container process starts by cron, so no stdout/stderr. Loggins happens through Haskell logging library, but without Docker I see log-messages in systemd journal.
â Paul-AG
Nov 8 '17 at 10:39
It depends on your logging library setting. If it is configured to emit a log to journald, use -v /run/systemd/journal/socket:/run/systemd/journal/socket . If it is configured to emit a log to syslog , use -v /dev/log:/dev/log . If it is configured.to emit a log to stderr, docker log driver has to capture it.
â takaomag
Nov 8 '17 at 12:26
Seems that -v /dev/log works. But what does log driver journald in this case?! Nothing? First, I supposed that this magic log-driver does all work and I don't need to mount socket or log storage from the host...
â Paul-AG
Nov 8 '17 at 13:05
What docker log driver does is just to capture stdout and stderr of a continered process. No magic! If your containered process emits a log only to syslog, docker log driver captures no log.
â takaomag
Nov 8 '17 at 13:26
One suggestion. If your process is haskell, logging-facade-journald may help you, though I do not know haskell well. github.com/sol/logging-facade/blob/master/README.md
â takaomag
Nov 8 '17 at 13:31
 |Â
show 1 more comment
up vote
1
down vote
up vote
1
down vote
docker journald driver captures the stdout and stderr of the container process.
On the other hand, logger command sends a messase to /dev/log.
Edit
It would be nice to do logger -s
docker journald driver captures the stdout and stderr of the container process.
On the other hand, logger command sends a messase to /dev/log.
Edit
It would be nice to do logger -s
edited Nov 8 '17 at 12:28
answered Nov 7 '17 at 11:51
takaomag
1112
1112
My container process starts by cron, so no stdout/stderr. Loggins happens through Haskell logging library, but without Docker I see log-messages in systemd journal.
â Paul-AG
Nov 8 '17 at 10:39
It depends on your logging library setting. If it is configured to emit a log to journald, use -v /run/systemd/journal/socket:/run/systemd/journal/socket . If it is configured to emit a log to syslog , use -v /dev/log:/dev/log . If it is configured.to emit a log to stderr, docker log driver has to capture it.
â takaomag
Nov 8 '17 at 12:26
Seems that -v /dev/log works. But what does log driver journald in this case?! Nothing? First, I supposed that this magic log-driver does all work and I don't need to mount socket or log storage from the host...
â Paul-AG
Nov 8 '17 at 13:05
What docker log driver does is just to capture stdout and stderr of a continered process. No magic! If your containered process emits a log only to syslog, docker log driver captures no log.
â takaomag
Nov 8 '17 at 13:26
One suggestion. If your process is haskell, logging-facade-journald may help you, though I do not know haskell well. github.com/sol/logging-facade/blob/master/README.md
â takaomag
Nov 8 '17 at 13:31
 |Â
show 1 more comment
My container process starts by cron, so no stdout/stderr. Loggins happens through Haskell logging library, but without Docker I see log-messages in systemd journal.
â Paul-AG
Nov 8 '17 at 10:39
It depends on your logging library setting. If it is configured to emit a log to journald, use -v /run/systemd/journal/socket:/run/systemd/journal/socket . If it is configured to emit a log to syslog , use -v /dev/log:/dev/log . If it is configured.to emit a log to stderr, docker log driver has to capture it.
â takaomag
Nov 8 '17 at 12:26
Seems that -v /dev/log works. But what does log driver journald in this case?! Nothing? First, I supposed that this magic log-driver does all work and I don't need to mount socket or log storage from the host...
â Paul-AG
Nov 8 '17 at 13:05
What docker log driver does is just to capture stdout and stderr of a continered process. No magic! If your containered process emits a log only to syslog, docker log driver captures no log.
â takaomag
Nov 8 '17 at 13:26
One suggestion. If your process is haskell, logging-facade-journald may help you, though I do not know haskell well. github.com/sol/logging-facade/blob/master/README.md
â takaomag
Nov 8 '17 at 13:31
My container process starts by cron, so no stdout/stderr. Loggins happens through Haskell logging library, but without Docker I see log-messages in systemd journal.
â Paul-AG
Nov 8 '17 at 10:39
My container process starts by cron, so no stdout/stderr. Loggins happens through Haskell logging library, but without Docker I see log-messages in systemd journal.
â Paul-AG
Nov 8 '17 at 10:39
It depends on your logging library setting. If it is configured to emit a log to journald, use -v /run/systemd/journal/socket:/run/systemd/journal/socket . If it is configured to emit a log to syslog , use -v /dev/log:/dev/log . If it is configured.to emit a log to stderr, docker log driver has to capture it.
â takaomag
Nov 8 '17 at 12:26
It depends on your logging library setting. If it is configured to emit a log to journald, use -v /run/systemd/journal/socket:/run/systemd/journal/socket . If it is configured to emit a log to syslog , use -v /dev/log:/dev/log . If it is configured.to emit a log to stderr, docker log driver has to capture it.
â takaomag
Nov 8 '17 at 12:26
Seems that -v /dev/log works. But what does log driver journald in this case?! Nothing? First, I supposed that this magic log-driver does all work and I don't need to mount socket or log storage from the host...
â Paul-AG
Nov 8 '17 at 13:05
Seems that -v /dev/log works. But what does log driver journald in this case?! Nothing? First, I supposed that this magic log-driver does all work and I don't need to mount socket or log storage from the host...
â Paul-AG
Nov 8 '17 at 13:05
What docker log driver does is just to capture stdout and stderr of a continered process. No magic! If your containered process emits a log only to syslog, docker log driver captures no log.
â takaomag
Nov 8 '17 at 13:26
What docker log driver does is just to capture stdout and stderr of a continered process. No magic! If your containered process emits a log only to syslog, docker log driver captures no log.
â takaomag
Nov 8 '17 at 13:26
One suggestion. If your process is haskell, logging-facade-journald may help you, though I do not know haskell well. github.com/sol/logging-facade/blob/master/README.md
â takaomag
Nov 8 '17 at 13:31
One suggestion. If your process is haskell, logging-facade-journald may help you, though I do not know haskell well. github.com/sol/logging-facade/blob/master/README.md
â takaomag
Nov 8 '17 at 13:31
 |Â
show 1 more comment
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402850%2fhow-to-get-logs-from-docker-with-journald-driver%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Hmm, I added
-v /dev/log:/dev/logand it seems to work now, so question is - is it dirty hack or Docker documentation lacks this mandatory mount-point?â Paul-AG
Nov 6 '17 at 16:15
seems that it's workaround only
â Paul-AG
Nov 6 '17 at 17:20