Explorar el Código

write overridden host into request packet for log captures

Tobias Begalke hace 6 años
padre
commit
36399ac68b
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      main.go

+ 6 - 2
main.go

@@ -312,7 +312,7 @@ func nginxLogCapture(logfile, format string) {
 			CreatedAt: timeStamp.Unix(),
 			Url:       reqData[2],
 			Method:    reqData[1],
-			Host:      "[not available]",
+			Host:      host,
 			Protocol:  reqData[3],
 		}
 
@@ -381,7 +381,11 @@ func apacheLogCapture(logfile string) {
 			vhostAndPort := strings.Split(logEntry.VirtualHost, ":")
 			virtualHost = vhostAndPort[0]
 		} else {
-			vhost = "[not available]"
+			if config.HostName != "" {
+				vhost = config.HostName
+			} else {
+				vhost = "[not available]"
+			}
 		}
 
 		request := data.Request{