# Maria log-bin file

**URL:** <https://forums.percona.com/t/maria-log-bin-file/18505>\
**Category:** Uncategorized\
**Created:** [November 11, 2022, 11:56pm UTC](https://forums.percona.com/t/maria-log-bin-file/18505 "2022-11-11T23:56:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dba1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dba1/32/24223_2.png) [@Dba1](https://forums.percona.com/u/Dba1)\
**Post date:** [November 11, 2022, 11:56pm UTC](https://forums.percona.com/t/maria-log-bin-file/18505/1 "2022-11-11T23:56:44Z")

</div>

Hello team,

Does anyone know the best way to extract all the INSERTS AND UPDATE IN A MARIA BINLOG file of 1GB IN SIZE. I have a some bin logs files more than 20 of them. But I will like to extract the inserts and update in each binlog file which is about 1GB in size.  
Note: each binlog file is 1GB. I have 20 of them.I will take one at a time

I have tried some ways out but I do not want it to impact my serve . Thank you

---

<div class="post-metadata">

**Author:** ![CTutte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ctutte/32/1341_2.png) [@CTutte](https://forums.percona.com/u/CTutte)\
**Post date:** [November 15, 2022, 12:11pm UTC](https://forums.percona.com/t/maria-log-bin-file/18505/2 "2022-11-15T12:11:39Z")

</div>

Hi Dba1,

To impact the server the least, the best is to copy the files to some other server for processing.

Then for inspecting the content of the binary log you need to use mysqlbinlog tool as explained in the following links:

> **[Using mysqlbinlog](https://mariadb.com/kb/en/using-mysqlbinlog/)**
>
> Viewing the binary log with mysqlbinlog.

> **[mysqlbinlog Options](https://mariadb.com/kb/en/mysqlbinlog-options/)**
>
> Options supported by mysqlbinlog.

Examining the content of the binary log will show everything inside the log, i.e not only INSERT and UPDATE but also DELETES and DDLS. You need to use grep and other linux commands to only get what you need.

Regards

---

<div class="post-metadata">

**Author:** ![Dba1](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dba1/32/24223_2.png) [@Dba1](https://forums.percona.com/u/Dba1)\
**Post date:** [November 15, 2022, 2:16pm UTC](https://forums.percona.com/t/maria-log-bin-file/18505/3 "2022-11-15T14:16:08Z")

</div>

Thank you @CTutte for looking at this. Now I’m trying to replay all the binary logs they are 1GB each like I said earlier. When I replayed one it took more than 2hours to finish. Is there any better way to get this done. To me if I have 40 of them it’s going to be in days.

Also I piped them into .sql file and I found out that each one 1GB I thought was not it was more than that , each one amounted to roughly 6GB in my .sql file. The behavior is quiet strange.

Note: Binary\_transaction\_compressed\_level wasn’t used where I took this binary logs

I need help

---

<div class="post-metadata">

**Author:** ![CTutte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ctutte/32/1341_2.png) [@CTutte](https://forums.percona.com/u/CTutte)\
**Post date:** [November 15, 2022, 2:20pm UTC](https://forums.percona.com/t/maria-log-bin-file/18505/4 "2022-11-15T14:20:51Z")

</div>

If you want to do PITR (point in time recovery) you can use a strategy similar to what is described in [MySQL Point in Time Recovery the Right Way - Percona Database Performance Blog](https://www.percona.com/blog/2017/10/23/mysql-point-in-time-recovery-right-way/)

This way you can take advantage of parallel replication, start/top and replication filters, etc…

If you only want to apply certain statements, then you need to manually parse the binary log file which will be time consuming and might not be compatible with above strategy.

Also do check system resources. Does the server has enough CPU and disk capacity? Applying 1 GB worth of binary logs should be faster than 1 day except if the server does not have much capacity
