Giter Site home page Giter Site logo

fluent-plugin-sqlite3's Introduction

README fluent-plugin-sqlite3

Fluent::Sqlite3Output

Required gems

  • sqlite3

Getting started

Add a following directive to fluent.conf and launch fluentd.

<match sqlite3.**>
  type sqlite3
  path test.db
</match>

Then run next.

echo '{"name":"Jhon","age":24}' | fluent-cat sqlite3.persons
echo '{"name":"Mike","age":27}' | fluent-cat sqlite3.persons

Let's see the database.

sqlite3 test.db "select * from persons"
1|Jhon|24
2|Mike|27

Ad hoc mode

Getting started is in ad hoc mode.

  • tables are created when it's needed
  • table names are the 2nd later part of tag, so don't contain illegal characters for table name
  • primary key is id and auto increment
  • column names are corresponding to all keys for given json

Strict mode

If a schema you use is already fixed, you can use strict mode.

In the case, table and columns parameters should be used.

<match sqlite3.**>
  type    sqlite3
  path    test.db
  table   persons
  columns name, age, country
</match>

Optional parameters

  • includes: is in order to insert the columns you need
  • excludes: is in order to filter out some keys you don't need to insert

Configuration

<match sqlite3.**>
  type sqlite3
  path test.db

  ## strict mode
  ## -----------
  ## Expects the table already exists and it has the columns.
  #table   persons
  #columns name, age, country

  ## ad hoc mode
  ## -----------
  ## this mode is enabled in case table and columns
  ## parameters are empty.
  ##
  ## echo '{"name":"Jhon","age":24}' | sqlite3.persons
  ##
  ## This creates a new table PERSONS which
  ## has "name" and "age" columns.
  ## The primary key is "id" which is AUTOINCREMENT.

  ## includes keys of json when inserting a new record
  #includes name, eye
  ## excludes keys of json when inserting a new record
  #excludes hair, eye

  ## fluentd built-in options
  buffer_type    memory
  flush_interval 1s
  retry_limit    1
  retry_wait     1s
  num_threads    1
</match>

License

MIT License

fluent-plugin-sqlite3's People

Contributors

tmtk75 avatar koron avatar

Watchers

Mikhael avatar

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.