# ROTATE\_EVENT

When a [binary log](/docs/server/server-management/server-monitoring-logs/binary-log.md) file exceeds the configured size limit, a `ROTATE_EVENT` is written at the end of the file, pointing to the next file in the sequence.

`ROTATE_EVENT` is generated locally and written to the binary log on the master. It is also written when a [FLUSH LOGS](/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush.md) statement occurs on the master server.

The `ROTATE_EVENT` is sent to the connected replica servers.

## Header

* The Event Type is `ROTATE_EVENT` (`0x4`).

## Fields

* [uint<8>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#fixed-length-bytes) The position of the first event in the next log file. It always contains the number `4` (meaning the next event starts at position 4 in the next binary log).
* [string\<EOF>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#fixed-length-bytes) The next binary log name. The filename is not null-terminated.

## Example of Transmission With CRC32 (The Last 4 Bytes)

```
T 127.0.0.1:8808 -> 127.0.0.1:57157 [AP]
  30 00 00 4d 00 bc 4e 21    5a 04 d9 27 00 00 2f 00    0..M..N!Z..'../.
  00 00 c0 01 00 00 00 00    04 00 00 00 00 00 00 00    ................
  6d 79 73 71 6c 2d 62 69    6e 2e 30 30 30 30 31 39    mysql-bin.000019
  b2 bc db bf                                           ....
```

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/rotate_event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
