Docker Cookbook


Discussion You can get a continuous log stream by using the  -f option: 9.4 Getting the Logs of a Container with docker logs | 279



Download 6,31 Mb.
Pdf ko'rish
bet219/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   215   216   217   218   219   220   221   222   ...   260
Bog'liq
Docker Cookbook

Discussion
You can get a continuous log stream by using the 
-f
option:
9.4 Getting the Logs of a Container with docker logs | 279


$ docker logs -f gloomy_mclean
192.168.34.1 - - [10/Mar/2015:10:12:35 +0000] "GET / HTTP/1.1" 200 612 "-" ...
...
In addition, you can monitor the process running in the container with 
docker top
:
$ docker top gloomy_mclean
UID PID PPID ... CMD
root 5605 4732 ... nginx: master process nginx -g daemon off;
syslog 5632 5605 ... nginx: worker process
9.5 Using a Different Logging Driver than the Docker
Daemon
Problem
By default, Docker provides container logs through JSON files. The logs are available
via the 
docker logs
command (see 
Recipe 9.4
). However, you would like to collect
and aggregate your logs differently, potentially using systems like 
syslog
or 
jour
nald
.
Solution
Start containers by using the 
--log-driver
option and specify a logging driver. This
feature was introduced in Docker 1.6, and various drivers are being added in new
Docker releases. With the logging driver functionality, you can direct the Docker logs
to 
syslog

journald

GELF
(Graylog Extended Log Format), and 
Fluentd
. You can
also disable any logging entirely by setting the driver to none: 
--log-driver=none
.
Each driver and its options are well 
documented
.
When you define a logging driver different from the default 
json-
file
driver, the 
docker logs
command will not work.
You can use the logging driver functionality to redirect your logs to local 
syslog
or
journald
. But to illustrate this feature in a more advanced way, let’s use Fluentd to
collect all the logs of running containers. First you need to install the Fluentd pack‐
ages on your Docker host. The easiest way to do this is to use the 
Treasure Data
 dis‐
tribution of Fluentd called 
td-agent
. If you trust their installation procedure, you can
get it via 
curl
:
$ curl -L https://td-toolbelt.herokuapp.com/sh/\
install-ubuntu-trusty-td-agent2.sh | sh

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   215   216   217   218   219   220   221   222   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish