Skip to content

Commit 5ec25a0

Browse files
authored
Merge pull request #195531 from bishal41/patch-3
Configure "local logging driver" during Moby installation
2 parents ed63ab0 + a14dcf1 commit 5ec25a0

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

articles/iot-edge/production-checklist.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ If your devices are going to be deployed on a network that uses a proxy server,
246246

247247
* **Helpful**
248248
* Set up logs and diagnostics
249-
* Place limits on log size
249+
* Set up default logging driver
250250
* Consider tests and CI/CD pipelines
251251

252252
### Set up logs and diagnostics
@@ -285,17 +285,24 @@ Starting with version 1.2, IoT Edge relies on multiple daemons. While each daemo
285285

286286
When you're testing an IoT Edge deployment, you can usually access your devices to retrieve logs and troubleshoot. In a deployment scenario, you may not have that option. Consider how you're going to gather information about your devices in production. One option is to use a logging module that collects information from the other modules and sends it to the cloud. One example of a logging module is [logspout-loganalytics](https://github.com/veyalla/logspout-loganalytics), or you can design your own.
287287

288-
### Place limits on log size
288+
### Set up default logging driver
289289

290-
By default the Moby container engine does not set container log size limits. Over time this can lead to the device filling up with logs and running out of disk space. Consider the following options to prevent this:
290+
By default, the Moby container engine does not set container log size limits. Over time, this can lead to the device filling up with logs and running out of disk space. Configure your container engine to use the [`local` logging driver](https://docs.docker.com/config/containers/logging/local/) as your logging mechanism. `Local` logging driver offers a default log size limit, performs log-rotation by default, and uses a more efficient file format which helps to prevent disk space exhaustion. You may also choose to use different [logging drivers](https://docs.docker.com/config/containers/logging/configure/) and set different size limits based on your need.
291291

292-
#### Option: Set global limits that apply to all container modules
292+
#### Option: Configure the default logging driver for all container modules
293293

294-
You can limit the size of all container logfiles in the container engine log options. The following example sets the log driver to `json-file` (recommended) with limits on size and number of files:
294+
You can configure your container engine to use a specific logging driver by setting the value of `log driver` to the name of the log driver in the `daemon.json`. The following example sets the default logging driver to the `local` log driver (recommended).
295295

296296
```JSON
297297
{
298-
"log-driver": "json-file",
298+
"log-driver": "local"
299+
}
300+
```
301+
You can also configure your `log-opts` keys to use appropriate values in the `daemon.json` file. The following example sets the log driver to `local` and sets the `max-size` and `max-file` options.
302+
303+
```JSON
304+
{
305+
"log-driver": "local",
299306
"log-opts": {
300307
"max-size": "10m",
301308
"max-file": "3"
@@ -332,7 +339,7 @@ You can do so in the **createOptions** of each module. For example:
332339
"createOptions": {
333340
"HostConfig": {
334341
"LogConfig": {
335-
"Type": "json-file",
342+
"Type": "local",
336343
"Config": {
337344
"max-size": "10m",
338345
"max-file": "3"

articles/iot-edge/troubleshoot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ sudo iotedge check
5454

5555
The troubleshooting tool runs many checks that are sorted into these three categories:
5656

57-
* *Configuration checks* examines details that could prevent IoT Edge devices from connecting to the cloud, including issues with the config file and the container engine.
57+
* *Configuration checks* examine details that could prevent IoT Edge devices from connecting to the cloud, including issues with the config file and the container engine.
5858
* *Connection checks* verify that the IoT Edge runtime can access ports on the host device and that all the IoT Edge components can connect to the IoT Hub. This set of checks returns errors if the IoT Edge device is behind a proxy.
5959
* *Production readiness checks* look for recommended production best practices, such as the state of device certificate authority (CA) certificates and module log file configuration.
6060

@@ -293,7 +293,7 @@ If you're still troubleshooting, wait until after you've inspected the container
293293
docker rm --force <container name>
294294
```
295295

296-
For ongoing logs maintenance and production scenarios, [place limits on log size](production-checklist.md#place-limits-on-log-size).
296+
For ongoing logs maintenance and production scenarios, [Set up default logging driver](production-checklist.md#set-up-default-logging-driver).
297297

298298
## View the messages going through the IoT Edge hub
299299

includes/iot-edge-install-linux.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,18 @@ Install the Moby engine.
7373
sudo apt-get update; \
7474
sudo apt-get install moby-engine
7575
```
76-
7776
---
77+
Once the Moby engine is successfully installed, configure it to use [`local` logging driver](https://docs.docker.com/config/containers/logging/local/) as the logging mechanism. To learn more about logging configuration, see [Production Deployment Checklist](../articles/iot-edge/production-checklist.md#set-up-default-logging-driver).
78+
79+
* Create or open the Docker daemon's config file at `/etc/docker/daemon.json`.
80+
* Set the default logging driver to the `local` logging driver as shown in the example below.
81+
82+
```JSON
83+
{
84+
"log-driver": "local"
85+
}
86+
```
87+
* Restart the container engine for the changes to take effect.
7888

7989
> [!TIP]
8090
> If you get errors when you install the Moby container engine, verify your Linux kernel for Moby compatibility. Some embedded device manufacturers ship device images that contain custom Linux kernels without the features required for container engine compatibility. Run the following command, which uses the [check-config script](https://github.com/moby/moby/blob/master/contrib/check-config.sh) provided by Moby, to check your kernel configuration:

0 commit comments

Comments
 (0)