Is it possible to disable rotation of file completely?

We have observed that the APM-Server (v7.7) rotates the target file configured for file output at every restart of the server, even if the size limit has not been reached? Is this the intended behaviour and is this documented somewhere?
If the server is started several times it is possible to loose important information through file rotation much earlier than expected.
Hence, is it possible to disable file rotation completely? We would like to apply our own file rotation process that is even able to compress the files.

Hi @elastick, welcome to the forum!

We have observed that the APM-Server (v7.7) rotates the target file configured for file output at every restart of the server, even if the size limit has not been reached? Is this the intended behaviour and is this documented somewhere?

All logging options are documented at Configure logging | APM User Guide [8.11] | Elastic

It's not particularly prominent, but the rotate-on-startup behaviour is mentioned under Configure logging | APM User Guide [8.11] | Elastic. You can set that option to false to stop rotating on startup.

Hence, is it possible to disable file rotation completely? We would like to apply our own file rotation process that is even able to compress the files.

It's not currently possible to disable rotation entirely. You could set Configure logging | APM User Guide [8.11] | Elastic to a very large number.

What system are you running APM Server on? Linux, Windows? You might want to disable logging to files, and instead log to stderr, syslog, or Windows Event Log.

Hi Andrew, thank you for the fast response!
I think my question was not clear enough. I'm talking about the file rotation if output.file is configured (https://www.elastic.co/guide/en/apm/server/7.7/file-output.html). Or does log file setting rotate-on-startup be applied for the created output file too?

Oops! No, I just didn't read properly - sorry about that.

rotateonstartup configuration is not currently available for output.file. Looking at the code, it looks like it should be straightforward to add the option. If you'd like it added, could you please open a feature request at https://github.com/elastic/apm-server/issues?

We could also add config to disable rotation altogether, but how would you expect that to work? Would you truncate the original log file, similar to the logrotate "copytruncate" option? If you'd like a way of disabling rotation altogether, please add that to the feature request, along with how you would intend to use it.

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