|
@@ -278,9 +278,9 @@ func nginxLogCapture(logfile, format string) {
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
- if *useXForwardedAsSource {
|
|
|
+ if config.UseXForwardedAsSource {
|
|
|
xff, err := logEntry.Field("http_x_forwarded_for")
|
|
|
- if err != nil {
|
|
|
+ if err != nil && xff != "" {
|
|
|
remote = xff
|
|
|
}
|
|
|
}
|
|
@@ -387,7 +387,7 @@ func apacheLogCapture(logfile string) {
|
|
|
}
|
|
|
|
|
|
remote := logEntry.Host
|
|
|
- if *useXForwardedAsSource && logEntry.ForwardedFor != "" {
|
|
|
+ if config.UseXForwardedAsSource && logEntry.ForwardedFor != "" {
|
|
|
remote = logEntry.ForwardedFor
|
|
|
}
|
|
|
|