Giter Site home page Giter Site logo

gabrielbussolo / fluent-bit-mysql-output-plugin Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 24 KB

A simple Fluent Bit plugin for outputs on MySQL

License: Apache License 2.0

Dockerfile 16.96% Makefile 10.19% Go 72.85%
fluent-bit golang mysql plugin

fluent-bit-mysql-output-plugin's Introduction

Fluent Bit MySQL Output Plugin

This is plugin for Fluent Bit, an open-source data collector that can be used to collect, process, and forward logs and metrics data. This plugin allows you to write data to a MySQL database. It's influenced by the PostgreSQL output plugin for Fluent Bit and the MySQL Fluentd plugin.

Usage

Download the last release and add to your plugin directory, example:

curl -o /fluent-bit/etc/mysql-output-plugin.so https://github.com/gabrielbussolo/fluent-bit-mysql-output-plugin/releases/download/v0.1.0-alpha/mysql-output-plugin.so

Create a file to register the custom plugin (if you don't have one already):

plugins.conf:

[PLUGINS]
    Path /fluent-bit/etc/mysql-output-plugin.so

Add the configs to your fluent-bit.conf:

Key Description Default
Address The address of the MySQL server localhost:3306
User The user to connect to the MySQL server root
Password The password to connect to the MySQL server -
Database The database to connect to -
Table The table to connect to -

example:

# import the plugin
[SERVICE]
    Flush           1
    Log_Level       info
    plugins_file    /fluent-bit/etc/plugins.conf

# configure the plugin    
[OUTPUT]
    Name mysql
    Address localhost:3306
    User root
    Password my-secret-pw
    Database fluent_bit
    Table test

Is expected that the table already exists in the database with the following fields data, datetime and tag. The data field is a json type, the datetime field is a datetime and tag a varchar.

Example:

create table fluent_bit.test
(
    id       int auto_increment
        primary key,
    data     json         null,
    datetime datetime     null,
    tag      varchar(100) null
);

Next steps:

  • Add support to create a default table if it doesn't exist
  • Support async writes
  • Add options for the connection pool
  • Implement CI/CD

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.