Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mosquitto in Docker: logs not available #2730

Closed
schneich opened this issue Jan 17, 2023 · 1 comment
Closed

mosquitto in Docker: logs not available #2730

schneich opened this issue Jan 17, 2023 · 1 comment

Comments

@schneich
Copy link

Hi,

I have started HomeAssistant in Docker and had to start a container with mosquitto as well. It all works perfectly fine, except the mosquitto logging is not visible to docker/portainer. There is a log file, with contains all logs, but I did configure it otherwise. -> log_dest stdout
What do I need to change to get the logs into the docker console/portainer? As the logging is not working, I was wondering, what else from my config is not working?

mosquitto.conf

# mosquitto.conf (see man mosquitto.conf(5) https://mosquitto.org/man/mosquitto-conf-5.html

#############################################################################
#
# GENERAL SETTINGS
#
#############################################################################

# Allow for future listeners not related to main one
# per_listener_settings true

#############################################################################
#
# PROTOCOL / TROUGHPUT / PERFORMANCE
#
#############################################################################

# How much memmory we will allocate (MAX)
# 128MB = 134217728 byte
# 256MB = 268435456 byte
memory_limit 268435456

# mqtt v5 max keepalive
max_keepalive 7200

# mqtt v5 max packet
max_packet_size 65535

message_size_limit 65535

# Expire persistent clients that have not appeared for so much time
persistent_client_expiration 3d

#############################################################################
#
# PERSISTENCE
#
#############################################################################

# Should we even save
persistence true

# Where we save stuff
persistence_location /mosquitto/data

# Treat next settings as number of changes (if true) or seconds otherwise
autosave_on_changes true

# How often to save DB
autosave_interval 600

#############################################################################
#
# LOGGING
#
#############################################################################

# Set the format of the log timestamp.
log_timestamp true
log_timestamp_format %Y-%m-%dT%H:%M:%S

# What to log
log_type error
log_type warning
log_type notice
log_type information

# do not log to file ... we are in docker
log_dest file /mosquitto/log/mosquitto.log

# and stdout
log_dest stdout



#############################################################################
#
# LISTENERS
#
#############################################################################

# Listen for incoming network connection on the specified port.
listener 1883



#############################################################################
#
# Password File
#
#############################################################################

# Set the path to a password file
password_file /mosquitto/config/pwfile
#allow_anonymous true

compose.yaml


services:
  mosquitto:
    image: eclipse-mosquitto:openssl
    container_name: mosquitto
    networks:
      ipvlan70:
        ipv4_address: 192.168.70.4
    volumes:
      - /home/uadmin/Docker/mosquitto/config:/mosquitto/config
      - /home/uadmin/Docker/mosquitto/data:/mosquitto/data
      - /home/uadmin/Docker/mosquitto/log:/mosquitto/log
    restart: unless-stopped
    # mosquitto port specifications: https://test.mosquitto.org/ bzw. https://de.wikipedia.org/wiki/MQTT
    ports:
      - target: 1883
        host_ip: 0.0.0.0
        published: 1883
        mode: host


  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /home/uadmin/Docker/HomeAssistant/HomeAssistent_config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
#    privileged: true
    networks:
      macvlan30:
        ipv4_address: 192.168.30.20
#    ports:
      # Portal Access
#      - "8123:8123"
    depends_on:
      - mosquitto



# Volumes for persisting data
volumes:
  config:
    driver: local
  data:
    driver: local
  log:
    driver: local
  HomeAssistent_config:
    driver: local


# Network specifications
networks:
  macvlan30:
    external: true
  ipvlan70:
    external: true
@schneich
Copy link
Author

okay, I found my error. I had two mosquitto.conf files in two different locations my docker folders. I was editing the wrong one...

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant