@@ -79,6 +79,7 @@ Options:
7979 --label list Set key=value labels to the daemon
8080 --live-restore Enable live restore of docker when containers are still running
8181 --log-driver string Default driver for container logs (default "json-file")
82+ --log-format string Set the logging format ("text"|"json") (default "text")
8283 -l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
8384 --log-opt map Default log driver options for containers (default map[ ] )
8485 --max-concurrent-downloads int Set the max concurrent downloads (default 3)
@@ -890,6 +891,33 @@ Alternatively, you can set custom locations for CDI specifications using the
890891When CDI is enabled for a daemon, you can view the configured CDI specification
891892directories using the ` docker info ` command.
892893
894+ #### <a name =" log-format " ></a > Daemon logging format
895+
896+ The ` --log-format ` option or "log-format" option in the [ daemon configuration file] ( #daemon-configuration-file )
897+ lets you set the format for logs produced by the daemon. The logging format should
898+ only be configured either through the ` --log-format ` command line option or
899+ through the "log-format" field in the configuration file; using both
900+ the command-line option and the "log-format" field in the configuration
901+ file produces an error. If this option is not set, the default is "text".
902+
903+ The following example configures the daemon through the ` --log-format ` command
904+ line option to use ` json ` formatted logs;
905+
906+ ``` console
907+ $ dockerd --log-format=json
908+ # ...
909+ {"level":"info","msg":"API listen on /var/run/docker.sock","time":"2024-09-16T11:06:08.558145428Z"}
910+ ```
911+
912+ The following example shows a ` daemon.json ` configuration file with the
913+ "log-format" set;
914+
915+ ``` json
916+ {
917+ "log-format" : " json"
918+ }
919+ ```
920+
893921### Miscellaneous options
894922
895923IP masquerading uses address translation to allow containers without a public
@@ -1089,6 +1117,7 @@ The following is a full example of the allowed configuration options on Linux:
10891117 "labels" : [],
10901118 "live-restore" : true ,
10911119 "log-driver" : " json-file" ,
1120+ "log-format" : " text" ,
10921121 "log-level" : " " ,
10931122 "log-opts" : {
10941123 "cache-disabled" : " false" ,
@@ -1183,6 +1212,7 @@ The following is a full example of the allowed configuration options on Windows:
11831212 "insecure-registries" : [],
11841213 "labels" : [],
11851214 "log-driver" : " " ,
1215+ "log-format" : " text" ,
11861216 "log-level" : " " ,
11871217 "max-concurrent-downloads" : 3 ,
11881218 "max-concurrent-uploads" : 5 ,
0 commit comments