HiveMQ

Logback setting to archive event log

Hi,

I have deployed HiveMQ Enterprise v4.5.3 on my desktop and “event.log” is about 9.2 MB.

In the “logback.xml” I have set the “maxFileSize” to 5 MB. Rest of the setting is the same. But event.log is not getting archived to “event-%i.log.gz” file.

    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
        <maxFileSize>5MB</maxFileSize>
    </triggeringPolicy>

Please advice.

Regards,
Harsha

Hello Harsha,

Thanks for reaching out. Nice to see that you’re taking interest in HiveMQ and MQTT.

You can confirm changes applied by you in logback.xml after restarting the broker. The next step is either try connecting/disconnecting the client and then check the logs folder it should have the archived file created. You can check here for more details about HiveMQ event logs.

Kind regards,
Sheetal from HiveMQ team

Hi Sheetal,

Thanks for your response.

The archiving seems to work a couple of times and then stopped working entirely.

This is what I tried and observed.

I set the “maxFileSize” to 1 MB for the event.log file

< maxFileSize > 1MB < / maxFileSize >

The event log file was about 1.6 MB and I saw that the event.log file was archived to “event-1.log.gz”. I added some data to event.log file so it exceeds 1 MB and I was able to observe event.log getting archived to “event-2.log.gz”. I tried repeating the process in until it creates “event-5.log.gz” and then delete the oldest archived file. But after this I did not see the archiving happening. So I renamed the “event-1.log.gz” and “event-2.log.gz” to “event-1.log.gz_” and “event-2.log.gz_” and I was able to see the “event.log” getting archived to “event-1.log.gz”. But after this this I did not observe the archiving happening again. The event.log is about 1.5 MB. I tried several restarts and setting the “scanPeriod” to 6 seconds instead of 60.

< configuration scan=“true” scanPeriod=“6 seconds” >

I tried setting the “scan” to “false” and restarting the broker. Then I deleted all older “.log.gz” archived file’s. But it does not seem to be working.

I am running HiveMQ CE broker v2021.1 on Ubuntu 18.04.4 LTS

I have read about how event log works in the link you provided and followed the steps accordingly. But it does not seem to be working.

Please advice.

Thanks.

Regards,
Harsha

Hello Harsha,

We understand your concern and tried the steps mentioned by you. We are not able to reproduce this behaviour.

We have tested with the following setting and we can see that event.log files are archived successfully
<maxFileSize>1KB</maxFileSize>

Also, note that when a new file gets created older file names get changed for example
event-1.log.gz will become event-2.log.gz

Similarly, older files get deleted once the archived files count is reached to <maxIndex> of logback.xml.

Instead of manually modifying the files, we would suggest using a tool like MQTT CLI to create actual events.

I hope this helps.

Kind regards,
Sheetal from HiveMQ team

Hi Sheetal,

Thanks for your input’s.

I tried with the same setting that you mentioned with “maxFileSize” set to 1KB

< maxFileSize > 1KB < / maxFileSize >

I also modified the “scanPeriod” to 6 seconds

< configuration scan=“true” scanPeriod=“6 seconds” >

…and everything seems to be working and I can see the “event.log” getting archived (1 - 5) and the oldest getting deleted (by viewing the file modified time).

I changed the the “maxFileSize” to 1MB, ran some automation using a NodeJS client till the event log was about 7KB, stopped the automation and after a while changed the “maxFileSize” back to 1KB and I was able to see the file getting archived as expected. With these steps I am unable to find any problem with how event log is archived. I have used the exact installation with which I had first posted my concerns and everything seems to be working now. I will keep this under watch and report back if I run into any problem.

Thank you so much for your help.

Regards,
Harsha

1 Like

Hi Sheetal,

I wanted a small clarification on a different topic related to HiveMQ broker, but I am posting the message here. I hope this is ok.

I am trying “persistent sessions” and I generated some data so that the queue size is 1000 for 1 client which is disconnected and clean session set to 'false". I also noted in the Control center console the used disk space went up by 230 MB after generating this data. Then I connected the subscribing client to the broker and all the messages in the queue were delivered to the client and the queue size went down to 0. But I noticed the disk usage was still showing the same number even after the queue was cleared. I would like to know where is the persistent data stored and why didn’t the used disk space number come down after delivering all the data stored in persistence by the broker . I checked the “data” folder and the size was showing as 11 MB when the queue size was 1000. So is the queued data stored in some other directory on the disk?

I restarted the broker and after the restart the disk size was showing much lesser number than what I had noted before generating data for 1000 message queue size.

I have also noticed when the broker is started the disk space usage goes up by 100 MB in the 15 minutes and then stops. Is there a reason why this happens?

Please do let me know if you would need more information. I was trying this exercise with HiveMQ Enterprise version 4.5.3 on Ubuntu 18.04.4 LTS

Regards,
Harsha