LTSV parsing problem with the Go Weblog plugin

I’m trying to get Netdata to parse LTSV log entries from Apache. Starting with a minimal example:

LogFormat "time:%t\trequest_method:%m\tstatus:%>s\thost:%{Host}i" ltsv

which produces log entries like these:

time:[14/Jun/2021:17:02:48 +0000]	request_method:GET	status:404	host:localhost
time:[14/Jun/2021:17:02:48 +0000]	request_method:GET	status:404	host:127.0.0.1
time:[14/Jun/2021:17:02:48 +0000]	request_method:GET	status:404	host:[::1]
time:[14/Jun/2021:17:03:23 +0000]	request_method:GET	status:301	host:aja.bs.no
time:[14/Jun/2021:17:03:43 +0000]	request_method:GET	status:301	host:aja.bs.no

Netdata seems to mostly parse these fine. The requests, responses and http method charts all work fine, but not the vhost chart, which only shows “::1” (with 0 requests):

Checking the Netdata error log, I found the following error:

2021-06-14 16:48:47: go.d WARNING: web_log[apache_vhosts] error on adding dim to chart 'requests_by_vhost' : unacceptable symbol in dim ID 'req_vhost_aja.bs.no
' : '
'

Is there something wrong about how I specify the host field?

Here’s my web_log.conf:

jobs:
  - name: apache_vhosts
    path: /var/log/apache2/aja.access.log
    log_type: ltsv

Hi @danmichaelo

That is a bug, thanks for reporting. Fixed in pkg/logs: remove new line char when reading a line by ilyam8 · Pull Request #584 · netdata/go.d.plugin · GitHub.

1 Like