I tried to create nginx access log dashboard with promtail, loki and grafana.
But, could not display access logs by following error Invalid date
.
I got Time
, line
and id
columns, but only Time ns
column is something wrong…
Versions
- Grafana:
v7.0.3 (00ee734baf)
- Loki:
v1.2.0
- Promtail:
latest
in 06/12
Here is my configutorations.
- promtail.yml
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: nginx
static_configs:
- targets:
- localhost
labels:
job: nginx
service: web
__path__: /var/log/web.log
pipeline_stages:
- timestamp:
source: time
format: RFC3339
- nginx access log format
log_format json escape=json '{"time": "$time_iso8601",'
'"host": "$remote_addr",'
'"vhost": "$host",'
'"user": "$remote_user",'
'"status": "$status",'
'"protocol": "$server_protocol",'
'"method": "$request_method",'
'"path": "$request_uri",'
'"req": "$request",'
'"size": "$body_bytes_sent",'
'"reqtime": "$request_time",'
'"apptime": "$upstream_response_time",'
'"ua": "$http_user_agent",'
'"forwardedfor": "$http_x_forwarded_for",'
'"forwardedproto": "$http_x_forwarded_proto",'
'"referrer": "$http_referer",'
'"header": "$http_authorization"}';