Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx-clickhouse Can`t save logs: rows and cols cannot be empty #12

Open
yangdongxiang opened this issue Jul 4, 2020 · 1 comment
Open

Comments

@yangdongxiang
Copy link

After I successfully compile normally, I use a binary program to start, the steps are as follows:
./nginx-clickhouse -config_path config.yml
Returned
INFO[0000] Reading config file: config-sample.yml
INFO[0000] Trying to open logfile: /home/service/nginx/logs/host.access.log
INFO[0005] Preparing to save 99 new log entries.
ERRO[0005] Can`t save logs: rows and cols cannot be empty

My nginx-clickhouse configuration file

Settings

settings:
interval: 5 # in seconds
log_path: /home/service/nginx/logs/host.access.log # path to logfile
seek_from_end: false # start reading from the lasl line (to prevent duplicates after restart)

ClickHouse credentials

clickhouse:
db: metrics
table: nginx
host: localhost
port: 8123
credentials:
user: default
password:
columns:
RemoteAddr: remote_addr
RemoteUser: remote_user
TimeLocal: time_local
Request: request
Status: status
BytesSent: bytes_sent
HttpReferer: http_referer
HttpUserAgent: http_user_agent

NGINX

nginx:
log_type: main
log_format: $remote_addr-$remote_user [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent"

my clickhouse talbe schema
ip-172-31-5-250.ap-northeast-1.compute.internal :) desc nginx

DESCRIBE TABLE nginx

┌─name─────────────────┬─type───────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─ ┬─ttl_expression─┐
│ RemoteAddr │ String │ │ │ │ │ │
│ RemoteUser │ String │ │ │ │ │ │
│ TimeLocal │ DateTime │ │ │ │ │ │
│ Date │ Date │ DEFAULT │ toDate(TimeLocal) │ │ │ │
│ Request │ String │ │ │ │ │ │
│ RequestMethod │ String │ │ │ │ │ │
│ Status │ Int32 │ │ │ │ │ │
│ BytesSent │ Int64 │ │ │ │ │ │
│ HttpReferer │ String │ │ │ │ │ │
│ HttpUserAgent │ String │ │ │ │ │ │
│ RequestTime │ Float32 │ │ │ │ │ │
│ UpstreamConnectTime │ Float32 │ │ │ │ │ │
│ UpstreamHeaderTime │ Float32 │ │ │ │ │ │
│ UpstreamResponseTime │ Float32 │ │ │ │ │ │
│ Https │ FixedString(2) │ │ │ │ │ │
│ ConnectionsWaiting │ Int64 │ │ │ │ │ │
│ ConnectionsActive │ Int64 │ │ │ │ │ │
└──────────────────────┴──────────────────┴───────── ─────┴────────────────────┴─────────┴─────────────── ─────┴────────────────┘

17 rows in set. Elapsed: 0.002 sec.

Hope for your help~

@yangdongxiang yangdongxiang changed the title nginx-clickhouse start failed nginx-clickhouse Can`t save logs: rows and cols cannot be empty Jul 9, 2020
@peterborodatyy
Copy link
Contributor

Hi, can you send your logs file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants