定制 thecodingcompany/php-fluentd-mariadb 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thecodingcompany/php-fluentd-mariadb

Composer 安装命令:

composer require thecodingcompany/php-fluentd-mariadb

包简介

PHP Library to use with Fluentd exec_filter plugin

README 文档

README

Use this plugin to send data with the exec_filter plugin from FluentD (TCP) to MariaDB.

#TD-agent configuration example td-agent config example

## built-in TCP input
## @see http://docs.fluentd.org/articles/in_forward
## @see https://docs.fluentd.org/v0.12/articles/out_exec_filter
<source>
  @type forward
  @label @PHP_FILE
  port 2017
  bind 127.0.0.1
  @log_level debug
</source>
<label @PHP_FILE>
    <match php_out>
        #@type stdout
        @type exec_filter
        command /bin/php /usr/local/example.php 2>&1
        in_format json
        out_format json
        flush_interval 1s
        tag php_out
        @log_level debug
    </match>
</label>

#PHP Code (Example)

<?php
require_once("theCodingCompany/MariaDBStore.php");

$settings = array(
    "cdn"       => "mysql:host=127.0.0.1;port=3306;dbname=event_log;",
    "username"  => "root",
    "password"  => "MySecretPassword"
);

/*
* Example data: {"attributes":{"voornaam":"Victor","achternaam":"Angelier"}} that is forwarded from FluentD to STDIN
*/
$fields = array("attributes");

$maria = new theCodingCompany\MariaDBStore($settings);
$maria->setTable("event_log")
    ->setFields($fields)
    ->start();

The final data is stored in MariaDB, table: event_log, database: event_log, and value: {"voornaam":"Victor","achternaam":"Angelier"}

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固