@@ -80,6 +80,7 @@ Options:
8080 --label list Set key=value labels to the daemon
8181 --live-restore Enable live restore of docker when containers are still running
8282 --log-driver string Default driver for container logs (default "json-file")
83+ --log-format string Set the logging format ("text"|"json") (default "text")
8384 -l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
8485 --log-opt map Default log driver options for containers (default map[ ] )
8586 --max-concurrent-downloads int Set the max concurrent downloads (default 3)
@@ -891,6 +892,33 @@ Alternatively, you can set custom locations for CDI specifications using the
891892When CDI is enabled for a daemon, you can view the configured CDI specification
892893directories using the ` docker info ` command.
893894
895+ #### <a name =" log-format " ></a > Daemon logging format
896+
897+ The ` --log-format ` option or "log-format" option in the [ daemon configuration file] ( #daemon-configuration-file )
898+ lets you set the format for logs produced by the daemon. The logging format should
899+ only be configured either through the ` --log-format ` command line option or
900+ through the "log-format" field in the configuration file; using both
901+ the command-line option and the "log-format" field in the configuration
902+ file produces an error. If this option is not set, the default is "text".
903+
904+ The following example configures the daemon through the ` --log-format ` command
905+ line option to use ` json ` formatted logs;
906+
907+ ``` console
908+ $ dockerd --log-format=json
909+ # ...
910+ {"level":"info","msg":"API listen on /var/run/docker.sock","time":"2024-09-16T11:06:08.558145428Z"}
911+ ```
912+
913+ The following example shows a ` daemon.json ` configuration file with the
914+ "log-format" set;
915+
916+ ``` json
917+ {
918+ "log-format" : " json"
919+ }
920+ ```
921+
894922### Miscellaneous options
895923
896924IP masquerading uses address translation to allow containers without a public
@@ -1123,6 +1151,7 @@ The following is a full example of the allowed configuration options on Linux:
11231151 "labels" : [],
11241152 "live-restore" : true ,
11251153 "log-driver" : " json-file" ,
1154+ "log-format" : " text" ,
11261155 "log-level" : " " ,
11271156 "log-opts" : {
11281157 "cache-disabled" : " false" ,
@@ -1217,6 +1246,7 @@ The following is a full example of the allowed configuration options on Windows:
12171246 "insecure-registries" : [],
12181247 "labels" : [],
12191248 "log-driver" : " " ,
1249+ "log-format" : " text" ,
12201250 "log-level" : " " ,
12211251 "max-concurrent-downloads" : 3 ,
12221252 "max-concurrent-uploads" : 5 ,
0 commit comments