I'm using mysqlbinlog with row based replication, running in a cron, and reading from a remote server, which has quite a few log files. I only want to pull logs from a specific range of datetimes, using --start-datetime and --stop-datetime. I know I can use --to-last-log to have it scan until the relevant file, but what I ideally want to know is the name of the log file that is currently being used.
Is this something I can maybe get from mysqlbinlog, or maybe from the database itself?
Run SHOW MASTER STATUS
on the remote server and it will tell you the File and Position it is currently writing to.
For example:
mysql> SHOW MASTER STATUS\G
*************************** 1. row ***************************
File: mysql-bin.000045
Position: 326704890
Binlog_Do_DB:
Binlog_Ignore_DB: