Cannot output logs into MySql using Fluent Bit

70 Views Asked by At

I want to use the "td-agent-bit" service to output logs into MySql. I have installed MySql and it runs on port 3306 (I left the default port). Then I created a database named "logs_db". Inside the "logs_db" database I created a table named "logs_tb" with a column "text" of type varachar(255). I configured the output section of my "td-agent-bit.conf" file like this.

[OUTPUT]
    Name        mysql
    Match       *
    Host        localhost
    Port        3306
    Database    logs_db
    Table       logs_tb
    Column      text
    User        root
    Password    d3qfeftgwff

Then I restarted the "td-agent-bit" service but it gives an error:

Feb 12 08:23:57 fluent-bit-d-machine systemd[1]: td-agent-bit.service: Start request repeated too quickly.
Feb 12 08:23:57 fluent-bit-d-machine systemd[1]: td-agent-bit.service: Failed with result 'exit-code'.
Feb 12 08:23:57 fluent-bit-d-machine systemd[1]: Failed to start TD Agent Bit.

The "mysql" service run properly. So what is wrong?

1

There are 1 best solutions below

0
nix86 On

I fear that MySql is not supported by Fluent Bit. In fact when I launched the command "fluent-bit -H" to see all the available plugins I didn't see mysql, but I saw pgsql. Therefore I tried PostgreSql and it worked. The correct configuration is the following

[OUTPUT]
    Name                pgsql
    Match               *
    Host                localhost
    Port                5432
    User                postgres
    Password            j382h4dn223834oj4dn490
    Database            logs_db
    Table               logs_tb

"postgres" is the default user. "logs_db" is a database that must be created manually. Meanwhile the table "logs_tb" is created automatically. In the configuration we only have to indicate the name that it will be given, but we are not supposed to create it ourselves.