Download the PHP package hisune/log2ck without Composer
On this page you can find all versions of the php package hisune/log2ck. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hisune/log2ck
More information about hisune/log2ck
Files in hisune/log2ck
Package log2ck
Short Description Real-time, high-performance reading of log files and writing to clickhouse.
License Apache-2.0
Homepage https://github.com/hisune/log2ck
Informations about the package log2ck
log2ck
English | 中文
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
- 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
- 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
andgroup
name cannot contain spaces. - 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
Example of the content of the manager.php
file:
By default, the manager and worker execution logs can be seen in the vendor/hisune/log2ck/logs/
directory. You can also modify the storage path of these two logs through the configuration file.
config.php Configuration example
supervisord
It is recommended to use supervisor to manage your manager process.
clickhouse Log table structure
If you use monolog and use the default regular rules, you can directly use the following table structure. If you have a custom regular, you can customize your own clickhouse table structure based on your own regular matching results.
If the content of your message or context is json
, you can refer to clickhouse's json query function:https://clickhouse.com/docs/en/sql-reference/functions/json-functions/