Skip to content

Commit a509a44

Browse files
committed
Include WrittenBytes in LogData
1 parent 72054c3 commit a509a44

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

internal/command/command.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ type LogMetadata struct {
2222
}
2323

2424
type LogData struct {
25-
Username string `json:"username"`
26-
Meta LogMetadata `json:"meta"`
25+
Username string `json:"username"`
26+
WrittenBytes int64 `json:"written_bytes"`
27+
Meta LogMetadata `json:"meta"`
2728
}
2829

2930
func CheckForVersionFlag(osArgs []string, version, buildTime string) {
@@ -87,7 +88,8 @@ func NewLogData(project, username string) LogData {
8788
}
8889

8990
return LogData{
90-
Username: username,
91+
Username: username,
92+
WrittenBytes: 0,
9193
Meta: LogMetadata{
9294
Project: project,
9395
RootNamespace: rootNameSpace,

internal/sshd/sshd.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ func (s *Server) handleConn(ctx context.Context, nconn net.Conn) {
217217
logData := extractDataFromContext(ctxWithLogData)
218218

219219
ctxlog.WithFields(log.Fields{
220-
"duration_s": time.Since(started).Seconds(),
221-
"meta": logData.Meta,
220+
"duration_s": time.Since(started).Seconds(),
221+
"written_bytes": logData.WrittenBytes,
222+
"meta": logData.Meta,
222223
}).Info("access: finish")
223224
}
224225

0 commit comments

Comments
 (0)