承接 customergauge/logstash 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

customergauge/logstash

最新稳定版本:4.0.0

Composer 安装命令:

composer require customergauge/logstash

包简介

APM & Logging for Laravel powered by Logstash

README 文档

README

This library adapts Monolog for Laravel to communicate with Logstash for logging & metrics.

Installation

composer require customergauge/logstash

Usage

Logs

In the logging.php, define a custom channel for Laravel

'http' => [
    'driver' => 'custom',
    'via' => LogstashLoggerFactory::class,
    'address' => sprintf('tcp://%s:9601', env('LOGSTASH_ADDRESS')),
    'processor' => env('LOGSTASH_PROCESSOR'),
],

This will instruct Laravel to write any log to Logstash using a TCP connection on port 9601. TCP will guarantee log delivery. Processors allow to manipulate the $record array that gets sent to Logstash as JSON. The processor attribute accept http or queue values.

Metrics

The library also allows to collect application metrics using an apm configuration inside the logging.php file.

    'apm' => [
        'enable' => env('LOGSTASH_APM_ENABLE', true),
        'address' => sprintf('udp://%s:9602', env('LOGSTASH_ADDRESS')),
    ],

For metrics, the above configuration will instruct Laravel to use an UDP conncetion as a way to fire-and-forget. Delivery is not guaranteed, but code execution is not delayed by acknowledging metric delivery.

Processors

You may configure Http and Queue processors. Processors must implement the \CustomerGauge\Logstash\Processors\HttpProcessorInterface or the \CustomerGauge\Logstash\Processors\QueueProcessorInterface. They offer the chance to modify the $record that will be streamed to Logstash by using the ProcessorInterface system provided by Monolog.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 10
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-01