@@ -80,6 +80,7 @@ Options:
80
80
--label list Set key=value labels to the daemon
81
81
--live-restore Enable live restore of docker when containers are still running
82
82
--log-driver string Default driver for container logs (default "json-file")
83
+ --log-format string Set the logging format ("text"|"json") (default "text")
83
84
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
84
85
--log-opt map Default log driver options for containers (default map[])
85
86
--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
891
892
When CDI is enabled for a daemon, you can view the configured CDI specification
892
893
directories using the ` docker info ` command.
893
894
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
+
894
922
### Miscellaneous options
895
923
896
924
IP 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:
1123
1151
"labels" : [],
1124
1152
"live-restore" : true ,
1125
1153
"log-driver" : " json-file" ,
1154
+ "log-format" : " text" ,
1126
1155
"log-level" : " " ,
1127
1156
"log-opts" : {
1128
1157
"cache-disabled" : " false" ,
@@ -1217,6 +1246,7 @@ The following is a full example of the allowed configuration options on Windows:
1217
1246
"insecure-registries" : [],
1218
1247
"labels" : [],
1219
1248
"log-driver" : " " ,
1249
+ "log-format" : " text" ,
1220
1250
"log-level" : " " ,
1221
1251
"max-concurrent-downloads" : 3 ,
1222
1252
"max-concurrent-uploads" : 5 ,
0 commit comments