{"id":18489700,"url":"https://github.com/abicky/fluent-plugin-mysql-select-insert","last_synced_at":"2026-02-13T15:42:11.234Z","repository":{"id":56847073,"uuid":"131248807","full_name":"abicky/fluent-plugin-mysql-select-insert","owner":"abicky","description":"Fluentd output plugin to insert records by SELECT query.","archived":false,"fork":false,"pushed_at":"2019-09-10T18:40:04.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T18:11:14.775Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abicky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-27T05:19:01.000Z","updated_at":"2020-05-28T18:47:10.000Z","dependencies_parsed_at":"2022-09-09T01:01:16.539Z","dependency_job_id":null,"html_url":"https://github.com/abicky/fluent-plugin-mysql-select-insert","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Ffluent-plugin-mysql-select-insert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Ffluent-plugin-mysql-select-insert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Ffluent-plugin-mysql-select-insert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abicky%2Ffluent-plugin-mysql-select-insert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abicky","download_url":"https://codeload.github.com/abicky/fluent-plugin-mysql-select-insert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247931047,"owners_count":21020156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T12:57:37.062Z","updated_at":"2026-02-13T15:42:06.205Z","avatar_url":"https://github.com/abicky.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fluent-plugin-mysql-select-insert\n\n[Fluentd](https://fluentd.org/) output plugin to insert records by SELECT query.\nYou can select records using events data and join multiple tables.\n\n## Installation\n\n### RubyGems\n\n```\n$ gem install fluent-plugin-mysql-select-insert\n```\n\n### Bundler\n\nAdd following line to your Gemfile:\n\n```ruby\ngem \"fluent-plugin-mysql-select-insert\"\n```\n\nAnd then execute:\n\n```\n$ bundle\n```\n\n## Configuration\n\nParameter | Description    | Default\n----------|----------------|-------------\nhost      | Database host  | 127.0.0.1\nport      | Database port  | 3306\ndatabase  | Database name  | (required)\nusername  | Database user  | (required)\npassword  | Database password | (empty string)\ntable     | Table into which records are inserted | (required)\nselect_query | SELECT query without WHERE clause to insert records | (required)\ncondition_column | Column used in WHERE clause to compare with values of 'condition_key' in events | (required)\ncondition_key | Key whose value is used in WHERE clause to compare with 'condition_column' | (required)\nextra_condition | Extra condition used in WHERE clause. You can specify placeholders like 'col1 = ? AND col2 = ?, ${tag[0]}, ${tag[1]}'. The metadata is extracted in the second or following arguments. | (empty array)\ninserted_columns | Columns to be inserted. You should insert all columns by the select query if you don't specify the value. | nil\nignore    | Add 'IGNORE' modifier to INSERT statement | false\n\n## Example Configuration\n\n```\n\u003cmatch pattern\u003e\n  @type mysql_select_insert\n  database fluent_plugin_mysql_select_insert\n  username root\n\n  table accessed_users\n\n  select_query \"SELECT\n      users.id\n    FROM\n      users\n      INNER JOIN\n        devices\n      ON\n        devices.id = users.device_id\"\n\n  condition_key uuid\n  condition_column devices.uuid\n  extra_condition \"app_id = ?, ${app_id}\"\n\n  ignore true\n\n  \u003cbuffer app_id\u003e\n  \u003c/buffer\u003e\n\u003c/match\u003e\n```\n\nAssuming that the following data comes in:\n\n```\npattern {\"uuid\":\"03449258-29ce-403c-900a-a2c6ea1d09a2\",\"app_id\":1}\npattern {\"uuid\":\"11aebc82-b661-44ab-951d-d1618058699a\",\"app_id\":1}\n```\n\nThe INSERT statement will be like below:\n\n```\nINSERT IGNORE INTO\n  accessed_users\nSELECT\n  users.id\nFROM\n  users\n  INNER JOIN\n    devices\n  ON\n    devices.id = users.device_id\nWHERE\n  uuid IN (\n    '03449258-29ce-403c-900a-a2c6ea1d09a2',\n    '11aebc82-b661-44ab-951d-d1618058699a'\n  )\n  AND app_id = 1\n;\n```\n\n\n## Copyright\n\n* Copyright(c) 2018- abicky\n* License\n  * Apache License, Version 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabicky%2Ffluent-plugin-mysql-select-insert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabicky%2Ffluent-plugin-mysql-select-insert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabicky%2Ffluent-plugin-mysql-select-insert/lists"}