Quantcast
Channel: Support & Bugs - Matomo forums
Viewing all articles
Browse latest Browse all 5706

Live logs with Caddy server and rsyslog possible?

$
0
0

@MrAlex wrote:

Hi all,

I was wondering if anyone may have any insight into getting live logs analytics working with Caddy server (v2)?

How I imagine it would work, not too dissimilar from the matomo log analytics instructions for nginx:

caddy -> syslog -> (syslog central server) -> import_logs.py -> matomo

How I have the Caddyfile set to log:

log {
        output net 0.0.0.0:514
}

How I have rsyslog.conf set to monitor:


# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")

# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")

$template remote-incoming-logs,"/var/log/rsyslogged/%PROGRAMNAME%.log"
*.* ?remote-incoming-logs

Example Format of said output in /var/log/rsyslogged/caddy.log:

2020-04-30T12:47:59.098985+02:00 sd-153183 caddy[5946]: {"level":"info","ts":1588243679.098609,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/1.1","remote_addr":"X.X.X.X:29894","host":"X.X.X.X","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en-US;q=0.7,en;q=0.3"],"Dnt":["1"],"Connection":["keep-alive"],"Cache-Control":["max-age=0"],"If-None-Match":["\"q9dj779fm\""],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Firefox/68.0"],"Accept-Encoding":["gzip, deflate"],"Upgrade-Insecure-Requests":["1"],"If-Modified-Since":["Sun, 26 Apr 2020 02:35:31 GMT"]}},"common_log":"X.X.X.X - - [30/Apr/2020:12:47:59 +0200] \"GET / HTTP/1.1\" 304 0","latency":0.005043762,"size":0,"status":304,"resp_headers":{"Server":["Caddy"],"Etag":["\"q9dj779fm\""]}}

But I am not sure where to go from here. Any input would be greatly appreciated!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5706

Trending Articles