PHPackages                             hisune/log2ck - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. hisune/log2ck

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

hisune/log2ck
=============

Real-time, high-performance reading of log files and writing to clickhouse.

1.1.8(2y ago)112131[1 issues](https://github.com/hisune/log2ck/issues)Apache-2.0PHPPHP &gt;=7.2

Since Mar 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/hisune/log2ck)[ Packagist](https://packagist.org/packages/hisune/log2ck)[ Docs](https://github.com/hisune/log2ck)[ RSS](/packages/hisune-log2ck/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

log2ck
------

[](#log2ck)

English | [中文](./readme.zh.md)

[![Latest Stable Version](https://camo.githubusercontent.com/a2de8dbe41907dc6c5737b94a187ca2bbd5f63438d3c8e686a8025b587ba2852/687474703a2f2f706f7365722e707567782e6f72672f686973756e652f6c6f6732636b2f76)](https://packagist.org/packages/hisune/log2ck) [![Total Downloads](https://camo.githubusercontent.com/bd4490a13edf78a548a7ed7ad42bc3a5297af7a8d3b2b68fd8bf7a92631ad06c/687474703a2f2f706f7365722e707567782e6f72672f686973756e652f6c6f6732636b2f646f776e6c6f616473)](https://packagist.org/packages/hisune/log2ck) [![Latest Unstable Version](https://camo.githubusercontent.com/982d9ade761e2b11d54ac6fd2bc406e2239a65508dc0fe95fd0e355ea970a681/687474703a2f2f706f7365722e707567782e6f72672f686973756e652f6c6f6732636b2f762f756e737461626c65)](https://packagist.org/packages/hisune/log2ck) [![License](https://camo.githubusercontent.com/c9b3392c1ac42cc003c7225c3250851ebb5ce6e10cc52013e82d6734915cad95/687474703a2f2f706f7365722e707567782e6f72672f686973756e652f6c6f6732636b2f6c6963656e7365)](https://packagist.org/packages/hisune/log2ck) [![PHP Version Require](https://camo.githubusercontent.com/29c0bc0c80b00038d13d3bc4af568c8ada41debb7b298737ad0a31feca7a9f1e/687474703a2f2f706f7365722e707567782e6f72672f686973756e652f6c6f6732636b2f726571756972652f706870)](https://packagist.org/packages/hisune/log2ck)

This tool can write the monolog standard log directly to clickhouse in real time via the tcp protocol. If you can write regular rules, other standardized log can also support it.

### Feature

[](#feature)

- Minimalist code
- High performance (Verify that the cpu usage in online business is only 1/20 of `filebeat`)
- No dependence on third-party services (such as queues, etc.)
- Configurable
- Customization (custom regularization, line processing callback functions)
- Supports reading log divided by day
- Supports automatic breakpoint resume collection
- Supports batch insert data
- Supports graceful restart

### Usage specification

[](#usage-specification)

1. If you use the default regularity, the log file that needs to be read must be the standard default monolog log format file, and the monolog `name` and `group` name cannot contain spaces.
2. The log to be read must be one line at a time. For example, monolog needs to set the formatter to: `'allowInlineLineBreaks'= > false`

### How to use

[](#how-to-use)

```
# Install
composer require "hisune/log2ck"
# Modify config.php to the configuration you want
cp vendor/hisune/log2ck/test.config.php config.php
# Create manager
vim manager.php
```

Example of the content of the `manager.php` file:

```
