Mosqitto log file with time stamp

Hello friends
I am new in this
I just want to see the time in mosquitto log file when actual action is perform for debugging .
In my mosquitto.config file configuration is :-
connection_messages true
log_type all
log_dest file /var/log/mosquitto/Avi_mosquitto.log
log_timestamp true
allow_anonymous true
Still there is no time in the log file . if any one know where i am wrong please correct me …
Thank you
Regads
Chandni

Switch to rsyslog:

In /etc/mosquitto/mosquitto.conf:

log_dest syslog
log_facility 0
log_type error
log_type warning
log_type information
log_timestamp true

In /etc/rsyslog.conf:

local0.*                        -/var/log/mosquitto/server.log

Then:

systemctl restart rsyslog.service
systemctl restart mosquitto.service

Of course, you can change the facility (from local0) and the file name to whatever you want
Pay attention to directory permissions to make sure that syslog can write the file.

1 Like

I have still some error in my mosquittto log file

plz help me
and thank you in advance

my mosquitto configurations are :-
#mosquitto configuration
retry_interval 20
user root
allow_zero_length_clientid true
port 5005
max_connections -1
autosave_interval 1800
persistence false
persistence_file acclivate_mosquitto.db
persistence_location /home/odroid/Documents/
connection_messages true
log_dest syslog
log_facility 0
log_type error
log_type warning
log_type information
log_timestamp true
log_type all
#log_dest file /var/log/mosquitto/Avi_mosquitto.log
#log_timestamp true
allow_anonymous true
connection avc
address
topic # both
cleansession true
keepalive_interval 10

## And rsyslog.config are :- local0. /var/log/mosquitto/Avi_mosquitto.log add at the end of file*

Set the default permissions for all log files.

$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog

Where to place spool and state files

$WorkDirectory /var/spool/rsyslog

Include all config files in /etc/rsyslog.d/

$IncludeConfig /etc/rsyslog.d/*.conf

local0.* /var/log/mosquitto/Avi_mosquitto.log

And error log in Avi_mosquitto.log file are

1498199730: Socket error on client avc, disconnecting.
1498199730: Error in poll: Interrupted system call.
1498199730: mosquitto version 1.4.9 terminating

Thank you