Commandes Linux : docker-compose logs

DOCKER-COMPOSE LOGS

Commande : docker-compose logs
View output from containers.

Usage: logs [options] [SERVICE...]

Options:
    --no-color          Produce monochrome output.
    -f, --follow        Follow log output.
    -t, --timestamps    Show timestamps.
    --tail="all"        Number of lines to show from the end of the logs
                        for each container.

 

Afficher la sortie produite par les services spécifiés :

docker-compose logs [options] [SERVICE...]

ex :

$ docker-compose logs logstash
[...]
logstash_1       | 12:55:24.411 [Api Webserver] INFO  logstash.agent - Successfully started Logstash API endpoint {:port=>9600}
logstash_1       | {
logstash_1       |          "request" => "/api/object/5996fc0f4c06fb000f83b7",
logstash_1       |            "agent" => "\"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0\"",
logstash_1       |            "minor" => "0",
logstash_1       |             "auth" => "-",
logstash_1       |            "ident" => "-",
logstash_1       |             "type" => "nginx",
logstash_1       |             "path" => "/var/log/nginx.log",
logstash_1       |            "major" => "55",
logstash_1       |         "clientip" => "46.218.112.178",
logstash_1       |         "@version" => "1",
logstash_1       |             "host" => "c8adf8edaa41",
logstash_1       |     "extra_fields" => " \"-\"",
logstash_1       |            "geoip" => {
logstash_1       |               "timezone" => "Europe/Paris",
logstash_1       |                     "ip" => "46.218.112.178",
logstash_1       |               "latitude" => 48.8058,
logstash_1       |         "continent_code" => "EU",
logstash_1       |              "city_name" => "Alfortville",
logstash_1       |           "country_name" => "France",
logstash_1       |          "country_code2" => "FR",
logstash_1       |          "country_code3" => "FR",
logstash_1       |            "region_name" => "Val-de-Marne",
logstash_1       |               "location" => {
logstash_1       |             "lon" => 2.4204,
logstash_1       |             "lat" => 48.8058
logstash_1       |         },
logstash_1       |            "postal_code" => "94140",
logstash_1       |            "region_code" => "94",
logstash_1       |              "longitude" => 2.4204
logstash_1       |     },
logstash_1       |               "os" => "Windows 10",
logstash_1       |             "verb" => "GET",
logstash_1       |          "message" => "46.218.112.178 - - [28/Sep/2017:15:40:04 +0000] \"GET /api/object/5996fc0f4c06fb000f83b7 HTTP/1.1\" 200 501 \"https://mydomain.net/map\" \"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0\" \"-\"",
logstash_1       |             "tags" => [
logstash_1       |         [0] "nginx-geoip"
logstash_1       |     ],
logstash_1       |         "referrer" => "\"https://mydomain.net/map\"",
logstash_1       |       "@timestamp" => 2017-09-28T15:40:04.000Z,
logstash_1       |            "build" => "",
logstash_1       |         "response" => 200,
logstash_1       |            "bytes" => 501,
logstash_1       |             "name" => "Firefox",
logstash_1       |          "os_name" => "Windows 10",
logstash_1       |      "httpversion" => "1.1",
logstash_1       |           "device" => "Other"
logstash_1       | }
[...]
$ docker-compose logs -f --tail=3
Attaching to example-voting-app_worker_1, redis, db, example-voting-app_result_1, example-voting-app_vote_1
worker_1  | Connected to db
worker_1  | Found redis at 172.27.0.3
worker_1  | Connecting to redis
db        | LOG:  MultiXact member wraparound protections are now enabled
db        | LOG:  database system is ready to accept connections
db        | LOG:  autovacuum launcher started
vote_1    |  * Restarting with stat
vote_1    |  * Debugger is active!
vote_1    |  * Debugger PIN: 113-172-582
result_1  | Waiting for db
result_1  | Waiting for db
result_1  | Connected to db
redis     | 1:M 20 Oct 2018 20:26:38.509 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis     | 1:M 20 Oct 2018 20:26:38.509 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis     | 1:M 20 Oct 2018 20:26:38.509 * Ready to accept connections

 

Fermer le menu
%d blogueurs aiment cette page :