MariaDB starting with 10.2.3
The events that can be compressed are the events that normally can be of a significant size: Query events (for DDL and DML in statement-based replication), and row events (for DML in row-based replication).
Compression is fully transparent. Events are compressed on the master before being written into the binary log, and are uncompressed by the I/O thread on the slave before being written into the relay log. The mysqlbinlog command will likewise uncompress events for its output.
Currently, the zlib compression algorithm is used to compress events.
Compression will have the most impact when events are of a non-negligible size, as each event is compressed individually. For example, batch INSERT statements that insert many rows or large values, or row-based events that touch a number of rows in one query.
The log_bin_compress option is used to enable compression of events. Only events with data (query text or row data) above a certain size are compressed; the limit is set with the log_bin_compress_min_len option.