Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Log problems

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Iker.

On 2015-11-17 16:46, Iker Arbizu Azurmendi wrote:
> I need some help with my log configuration.

Without knowing your system type and mosquitto version an answer will
not be as precise as it could. In the following I assume you are on a
Unix-type system with a recent mosquitto.
Always state basic info as this, even sometimes also the obvious, it
can be crucial to debug complex problems.

> log_dest file /home/sysadmin/mosquitto/mosquitto.log

By default the broker is run as the system user named "mosquitto"
(configurable by the "user" keyword) except for a brief period during
startup. Thus the /home/sysadmin/mosquitto directory needs to be
accessible for this user.
Probably what happens is that the log file is created while the
process has root privileges during startup but when it is deescalated
to mosquitto it doesn't have permission to write any contents to it.

Try running mosquitto manually as "mosquitto -c /etc/mosquitto.conf"
to check what the broker reports on the command line. You'll probably
see something like what I get when configuring a log file in my root's
home directory (on Ubuntu 14.10, mosquitto 1.4.2);

$ sudo mosquitto -c /etc/mosquitto/mosquitto.conf
1447837310: Error: Unable to open log file /root/mosquitto-test.log
for writing.

The log file isn't created using v1.4.2 maybe you have created it
yourself?

> #log_types all

This should be "log_type all" to work as expected when activated.
But the default of "error, warning, notice and information" ought to
give you something to look at.

> the errors and connections are logged in /var/log/messages.

Sure you haven't got another *.conf file in /etc/mosquitto specifying
"log_dest syslog"?
Default should be stderr, and I can't see from the source code that it
will revert to syslog when failing on log_dest file.


Check out "man mosquitto.conf" for complete config documentation and
"man mosquitto" for command line usage.
Also "apropos mosquitto" will list all available man pages for mosquitto.

- -- 
    Mikkel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJWTERdAAoJEJ2luFWzaTSarfkH/1gZBmhVtJ49cCRBKqB5ltok
Pw+jjXGAtwPQGnas5SAoeowViRn+nyqXuhDPSPMsqapYXnFI4lIwU+09mB8dd13c
aKoBcSFzFU/gdAwTapX6mjwtJVIx5vNiJTRzRsCkio7rb1Yqsa6cMVn1twXwe82M
jt32T1fKu9Ytbe9UoN9BeT3Nf3f7ufVpv7mVnwOY9dmz1+TODKWXlccSZrJN7oqE
cdRcmeEN3EH19NkuEtrGmk76xMQCcnVio9YHjZlNAlKhIEXnshFnnU5Vy32M/Wx1
wwjJhzIJCgy48TlkIAWy4m0eFt6+4OYKnPTM+7m++mV1qBmjcIQprxff0yawhOA=
=FLeN
-----END PGP SIGNATURE-----


Back to the top