Browse Source

print nginx log file entry when tracing

Tobias von Dewitz 6 years ago
parent
commit
f002358593
1 changed files with 5 additions and 0 deletions
  1. 5 0
      main.go

+ 5 - 0
main.go

@@ -24,6 +24,7 @@ import (
 	"github.com/google/gopacket/layers"
 	"github.com/google/gopacket/pcap"
 	"github.com/hpcloud/tail"
+	"github.com/kr/pretty"
 	"github.com/nats-io/nats"
 	"github.com/nats-io/nats/encoders/protobuf"
 	"github.com/satyrius/gonx"
@@ -272,6 +273,10 @@ func nginxLogCapture(logfile, format string) {
 			continue
 		}
 
+		if config.Trace {
+			pretty.Println(logEntry)
+		}
+
 		remote, err := logEntry.Field("remote_addr")
 		if err != nil {
 			log.Println(err)