avito-tech / nginx-log-collector

nginx-log-collector
55 stars 11 forks source link

how to install and use on debian. #8

Open 5x3 opened 4 years ago

5x3 commented 4 years ago

I have debian 8 and 9 how to install and run nginx-log-collector ?

5x3 commented 4 years ago

what can I do with it? what to check? and what is wrong?

CREATE TABLE nginx.error_log
(
    `event_datetime` DateTime, 
    `event_date` Date, 
    `server_name` LowCardinality(String), 
    `http_referer` String, 
    `pid` UInt32, 
    `sid` UInt32, 
    `tid` UInt64, 
    `host` LowCardinality(String), 
    `client` String, 
    `request` String, 
    `message` String, 
    `login` String, 
    `upstream` String, 
    `subrequest` String, 
    `hostname` LowCardinality(String)
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/logs_replicator/nginx.error2_log', '{macros}', event_date, (server_name, request, event_date), 8192)
5x3 commented 4 years ago

Also, what to do with error_log? nginx error_log don't support custom log format.

errx commented 4 years ago

Hi, you need a go compiler and make command after that just run make deb it should produce a debian package in build/ directory.

For error_log you should set format: error in your config (there is error_log parser included https://github.com/avito-tech/nginx-log-collector/blob/master/parser/error_log.go)