Skip to content

Commit 6156130

Browse files
committed
mosquitto: disable connection_message logging
* Connection messages may cause unnecessary flash wear * Fix docs to be precise about how docker log persistence
1 parent 9cc8533 commit 6156130

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.templates/mosquitto/iotstack_defaults/config/mosquitto.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ persistence_location /mosquitto/data
1414
log_dest stdout
1515
log_timestamp_format %Y-%m-%dT%H:%M:%S
1616

17+
# Reduce size and SD-card flash wear, safe to remove if using a SSD
18+
connection_messages false
19+
1720
# password handling:
1821
# password_file commented-out allow_anonymous true =
1922
# open access

docs/Containers/Mosquitto.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ Using `mosquitto.conf` as the example, assume you wish to use your existing file
209209

210210
Mosquitto logging is controlled by `mosquitto.conf`. This is the default configuration:
211211

212-
```
212+
```apacheconf
213213
#log_dest file /mosquitto/log/mosquitto.log
214214
log_dest stdout
215215
log_timestamp_format %Y-%m-%dT%H:%M:%S
216+
# Reduce size and SD-card flash wear, safe to remove if using a SSD
217+
connection_messages false
216218
```
217219

218220
When `log_dest` is set to `stdout`, you inspect Mosquitto's logs like this:
@@ -221,7 +223,9 @@ When `log_dest` is set to `stdout`, you inspect Mosquitto's logs like this:
221223
$ docker logs mosquitto
222224
```
223225

224-
Logs written to `stdout` are ephemeral and will disappear when your Mosquitto container is rebuilt, but this type of configuration reduces wear and tear on your SD card.
226+
Logs written to `stdout` are stored and persisted to disk as managed by Docker.
227+
They are kept over reboots, but are lost when your Mosquitto container is
228+
removed or updated.
225229

226230
The alternative, which *may* be more appropriate if you are running on an SSD or HD, is to change `mosquitto.conf` to be like this:
227231

@@ -246,7 +250,7 @@ $ sudo tail ~/IOTstack/volumes/mosquitto/log/mosquitto.log
246250

247251
> You need to use `sudo` because the log is owned by userID 1883 and Mosquitto creates it without "world" read permission.
248252
249-
Logs written to `mosquitto.log` do not disappear when your IOTstack is restarted. They persist until you take action to prune the file.
253+
Logs written to `mosquitto.log` persist until you take action to prune the file.
250254

251255
## Security
252256

@@ -699,7 +703,7 @@ If you have a use-case that needs port 9001, you can re-enable support by:
699703

700704
2. Inserting the additional listener in `mosquitto.conf`:
701705

702-
```
706+
```apacheconf
703707
listener 1883
704708
listener 9001
705709
```

0 commit comments

Comments
 (0)