Skip to content

Commit 006d9f4

Browse files
authored
Merge pull request #512 from ukkopahis/mosquitto-conn-msg
mosquitto: disable connection_message logging
2 parents 79b6b88 + 6156130 commit 006d9f4

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
@@ -224,10 +224,12 @@ Using `mosquitto.conf` as the example, assume you wish to use your existing file
224224

225225
Mosquitto logging is controlled by `mosquitto.conf`. This is the default configuration:
226226

227-
```
227+
```apacheconf
228228
#log_dest file /mosquitto/log/mosquitto.log
229229
log_dest stdout
230230
log_timestamp_format %Y-%m-%dT%H:%M:%S
231+
# Reduce size and SD-card flash wear, safe to remove if using a SSD
232+
connection_messages false
231233
```
232234

233235
When `log_dest` is set to `stdout`, you inspect Mosquitto's logs like this:
@@ -236,7 +238,9 @@ When `log_dest` is set to `stdout`, you inspect Mosquitto's logs like this:
236238
$ docker logs mosquitto
237239
```
238240

239-
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.
241+
Logs written to `stdout` are stored and persisted to disk as managed by Docker.
242+
They are kept over reboots, but are lost when your Mosquitto container is
243+
removed or updated.
240244

241245
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:
242246

@@ -261,7 +265,7 @@ $ sudo tail ~/IOTstack/volumes/mosquitto/log/mosquitto.log
261265

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

266270
## Security
267271

@@ -755,7 +759,7 @@ If you have a use-case that needs port 9001, you can re-enable support by:
755759

756760
2. Inserting the additional listener in `mosquitto.conf`:
757761

758-
```
762+
```apacheconf
759763
listener 1883
760764
listener 9001
761765
```

0 commit comments

Comments
 (0)