Description
- Gitea version (or commit ref): 1.12.4
- Can you reproduce the bug at https://try.gitea.io:
- Not relevant
Description
It is a common practice to forward all application/daemon logs to a single location (local syslog, remote aggregator, SIEM...) for easier searching, analysis and alerting.
Currently system notices (failing to update a mirror, git operation error, internal crons...) are logged to the database and you can browse them at https://my.domain.org/admin/notices. It is impossible (hard?) to forward database logs to a log aggregation system using standard tools. For example I can easily forward gitea logs to syslog using this simple configuration file (https://www.rsyslog.com/doc/v8-stable/configuration/modules/imfile.html), and be warned of errors using log monitoring/logwatch/graylog/lnav...:
# /etc/rsyslog.d/gitea.conf
# rsyslog - monitor gitea log files
module(load="imfile")
input(type="imfile"
File="/var/lib/gitea/log/access.log"
Tag="gitea:"
Facility="daemon"
PersistStateInterval="0")
input(type="imfile"
File="/var/lib/gitea/log/gitea.log"
Tag="gitea:"
Facility="daemon"
PersistStateInterval="0")
The local syslog daemon will pick up these log files, and add their messages to relevant outputs (/var/log/syslog
, network forwarding...)
But this doesn't include notices. I have had a mirror failing for weeks without realizing it because I never browse /admin/notices manually. And more interesting errors to track down :)
This could also be useful for #8, you can simply log audit logs to file without having to implement syslog logging in gitea itself - just add an imfile
watch on audit logs if you want it to go to syslog.
I think this should be logged to a separate log file notices.log
or you can implement it the same way as other loggers with NOTICES = [console,file,conn,smtp,database]
(https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini#L801)