Bug #83367 Making the server communicate the event when it rotates to a new binlog
Submitted: 13 Oct 2016 12:02
Reporter: Thomas Johansson Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:Any OS:Any
Assigned to: CPU Architecture:Any
Tags: binlog

[13 Oct 2016 12:02] Thomas Johansson
Description:
MySQL does not currently communicate the rotate binlog event in any way other than internally. If one wants to continuously keep backups of binlogs, the only way to do so is to write a program that monitors the filesystem for new files. It could be possible to do so with mysqlbinlog --read-from-remote-server but the behaviour is the same when used with --stop-never, mysqlbinlog quitely starts writing the next log.
An event of some kind could be triggered when switching to a new binlog to make backups of these files easier to manage.

How to repeat:
Feature request, N/A

Suggested fix:
Informix, for instance, has a configuration parameter called ALARMPROGRAM that lets you, the user, define what should happen when the server switched to a new logical log. Typically you would instruct it to make a backup of the log.
See https://www.ibm.com/support/knowledgecenter/SSGU8G_11.70.0/com.ibm.bar.doc/ids_bar_311.htm

An option doing something like "--stop-at-binlog-end" could also be added to mysqlbinlog to allow a remote server to perform backup for it, if written into a script or something similar.