hcportal-dev/rsyslog.conf
2025-08-12 08:48:46 +07:00

30 lines
807 B
Plaintext

# Load modules
module(load="imfile")
# Monitor specific error log file
input(type="imfile"
File="/app/src/api/log/Error-*.log"
Tag="api_error_logs"
Severity="error"
Facility="local0")
# Template to include severity
template(name="ErrorFormat" type="string" string="%syslogseverity-text%: %msg%\n")
# Filter out GET and POST logs
:msg, contains, "GET " stop
:msg, contains, "POST " stop
# Send error messages to stderr with severity
if $syslogtag contains 'api_error_logs' then {
action(type="omfile" file="/dev/stderr" template="ErrorFormat")
}
# Optionally, you can add more specific filters here
if $msg contains "PHP Fatal error:" or $msg contains "PHP Warning:" then {
action(type="omfile" file="/dev/stderr" template="ErrorFormat")
}
# Discard other logs
*.* stop