Skip to content

Commit

Permalink
log accounting flags
Browse files Browse the repository at this point in the history
Differential Revision: D64866117

fbshipit-source-id: d5ecdb01b0f78e24bea05c2f4c4311c52e874873
  • Loading branch information
Surya Ahuja authored and facebook-github-bot committed Oct 24, 2024
1 parent 458d90f commit f45b532
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmds/server/handlers/acct.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (a *AccountingRequest) Handle(response tq.Response, request tq.Request) {
return
}

a.RecordCtx(&request, tq.ContextUser, tq.ContextRemoteAddr, tq.ContextReqArgs, tq.ContextAcctType, tq.ContextPort, tq.ContextPrivLvl)
a.RecordCtx(&request, tq.ContextUser, tq.ContextRemoteAddr, tq.ContextReqArgs, tq.ContextAcctType, tq.ContextPort, tq.ContextPrivLvl, tq.ContextFlags)
// TODO implement a fallback for cases where a username may not be present.
c := a.GetUser(string(body.User))
if c == nil {
Expand Down
2 changes: 1 addition & 1 deletion cmds/server/handlers/response_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (l *ResponseLogger) Write(ctx context.Context, p []byte) (int, error) {
return 0, err
}
request := tq.Request{Header: *packet.Header, Body: packet.Body[:], Context: ctx}
l.Record(ctx, request.Fields(tq.ContextConnRemoteAddr, tq.ContextConnLocalAddr, tq.ContextUser, tq.ContextRemoteAddr, tq.ContextReqArgs, tq.ContextAcctType, tq.ContextPrivLvl, tq.ContextPort))
l.Record(ctx, request.Fields(tq.ContextConnRemoteAddr, tq.ContextConnLocalAddr, tq.ContextUser, tq.ContextRemoteAddr, tq.ContextReqArgs, tq.ContextAcctType, tq.ContextPrivLvl, tq.ContextPort, tq.ContextFlags))

return 0, nil
}
Expand Down
3 changes: 3 additions & 0 deletions ctx_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const ContextReqArgs ContextKey = "req-args"
// ContextAcctType ...
const ContextAcctType ContextKey = "type"

// ContextFlags logs the flags attribute of Accounting requests
const ContextFlags ContextKey = "flags"

// ContextPrivLvl ...
const ContextPrivLvl ContextKey = "priv-lvl"

Expand Down

0 comments on commit f45b532

Please sign in to comment.