Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error_log, access_log tackle syslog (#185) #302

Merged
merged 5 commits into from
Jun 9, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/core/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,13 +810,16 @@ func runtimeFromConfigure(configure []string) []string {
// AccessLogs returns a list of access logs in the config
func AccessLogs(p *proto.NginxConfig) map[string]string {
var found = make(map[string]string)
var name := ""
oliveromahony marked this conversation as resolved.
Show resolved Hide resolved

for _, accessLog := range p.GetAccessLogs().GetAccessLog() {
name = strings.Split(accessLog.GetName(), " ")[0]

// check if the access log is readable or not
if accessLog.GetReadable() && accessLog.GetName() != "off" {
name := strings.Split(accessLog.GetName(), " ")[0]
format := accessLog.GetFormat()
found[name] = format
} else {
} else if(!strings.Contains(name, "syslog:")){
log.Warnf("NGINX Access log %s is not readable or is disabled. Please make it readable and enabled in order for NGINX metrics to be collected.", accessLog.GetName())
}
}
Expand All @@ -827,13 +830,16 @@ func AccessLogs(p *proto.NginxConfig) map[string]string {
// ErrorLogs returns a list of error logs in the config
func ErrorLogs(p *proto.NginxConfig) map[string]string {
var found = make(map[string]string)
var name := ""

for _, errorLog := range p.GetErrorLogs().GetErrorLog() {
name = strings.Split(errorLog.GetName(), " ")[0]

// check if the error log is readable or not
if errorLog.GetReadable() {
name := strings.Split(errorLog.GetName(), " ")[0]
// In the future, different error log formats will be supported
found[name] = ""
} else {
} else if(!strings.Contains(name, "syslog:")){
log.Warnf("NGINX Error log %s is not readable or is disabled. Please make it readable and enabled in order for NGINX metrics to be collected.", errorLog.GetName())
}
}
Expand Down