Rolling log files


I would like to roll my sonarqube log files once every month. I have read the comments in the configuration file, but they are not very clear.
There is the section that says, "or by month (“time:yyyy-MM)”
I would like for the logs to be rolled on the first of every month, but the way I am understanding how the configuration would work is if I configured the above line to read, “time:2022-04”, then the logs would roll on April 1, 2022.

What do I need to do to roll the logs on the first of every month?

Thank you

Hey there.

April 1 being the first day of the month, it sounds like this would accomplish exactly what you’re expecting. Am I missing something?

Would the logs also roll on May 1, June 1…throughout the rest of the year, or would they only roll on April 1?

The config file isn’t clear on how exactly that works.

Thank you

Ah, okay, I understand the misunderstanding.

sonar.log.rollingPolicy is not configured with a specific date, but using the placeholders (yyyy, MM, dd).

So configuration like

sonar.log.rollingPolicy=yyyy-MM (do not substitute real dates) would ensure that the rollover happens each month.

You can see the default behavior in action (as by default sonar.log.rollingPolicy is configured with yyyy-MM-dd, and if you have a SonarQube instance running for longer than a day you’ll see the logs roll at midnight each day).

Thanks Colin,

Just to be sure I understand.

Leaving sonar.log.rollingPolicy configured to yyyy-MM-dd, the logs would roll over each day at midnight.

Leaving sonar.log.rollingPolicy configured to yyyy-MM, the logs would roll over each month.


Correct. Please also note that the log file won’t be generated until there is actually something to be logged.

Got it. thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.