@@ -79,6 +79,7 @@ Options:
79
79
--label list Set key=value labels to the daemon
80
80
--live-restore Enable live restore of docker when containers are still running
81
81
--log-driver string Default driver for container logs (default "json-file")
82
+ --log-format string Set the logging format ("text"|"json") (default "text")
82
83
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
83
84
--log-opt map Default log driver options for containers (default map[])
84
85
--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
890
891
When CDI is enabled for a daemon, you can view the configured CDI specification
891
892
directories using the ` docker info ` command.
892
893
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
+
893
921
### Miscellaneous options
894
922
895
923
IP 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:
1089
1117
"labels" : [],
1090
1118
"live-restore" : true ,
1091
1119
"log-driver" : " json-file" ,
1120
+ "log-format" : " text" ,
1092
1121
"log-level" : " " ,
1093
1122
"log-opts" : {
1094
1123
"cache-disabled" : " false" ,
@@ -1183,6 +1212,7 @@ The following is a full example of the allowed configuration options on Windows:
1183
1212
"insecure-registries" : [],
1184
1213
"labels" : [],
1185
1214
"log-driver" : " " ,
1215
+ "log-format" : " text" ,
1186
1216
"log-level" : " " ,
1187
1217
"max-concurrent-downloads" : 3 ,
1188
1218
"max-concurrent-uploads" : 5 ,
0 commit comments