mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
parent
3259e7149b
commit
11707132bd
2 changed files with 9 additions and 0 deletions
|
|
@ -334,6 +334,7 @@ func makeKolideKitHandlers(e KolideEndpoints, opts []kithttp.ServerOption) *koli
|
|||
func MakeHandler(svc kolide.Service, jwtKey string, logger kitlog.Logger) http.Handler {
|
||||
kolideAPIOptions := []kithttp.ServerOption{
|
||||
kithttp.ServerBefore(
|
||||
kithttp.PopulateRequestContext, // populate the request context with common fields
|
||||
setRequestsContexts(svc, jwtKey),
|
||||
),
|
||||
kithttp.ServerErrorLogger(logger),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
kithttp "github.com/go-kit/kit/transport/http"
|
||||
"github.com/kolide/fleet/server/kolide"
|
||||
)
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ func (mw loggingMiddleware) EnrollAgent(ctx context.Context, enrollSecret string
|
|||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "EnrollAgent",
|
||||
"ip_addr", ctx.Value(kithttp.ContextKeyRequestRemoteAddr).(string),
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
|
|
@ -34,6 +36,7 @@ func (mw loggingMiddleware) AuthenticateHost(ctx context.Context, nodeKey string
|
|||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "AuthenticateHost",
|
||||
"ip_addr", ctx.Value(kithttp.ContextKeyRequestRemoteAddr).(string),
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
|
|
@ -52,6 +55,7 @@ func (mw loggingMiddleware) GetClientConfig(ctx context.Context) (*kolide.Osquer
|
|||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "GetClientConfig",
|
||||
"ip_addr", ctx.Value(kithttp.ContextKeyRequestRemoteAddr).(string),
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
|
|
@ -71,6 +75,7 @@ func (mw loggingMiddleware) GetDistributedQueries(ctx context.Context) (map[stri
|
|||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "GetDistributedQueries",
|
||||
"ip_addr", ctx.Value(kithttp.ContextKeyRequestRemoteAddr).(string),
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
|
|
@ -88,6 +93,7 @@ func (mw loggingMiddleware) SubmitDistributedQueryResults(ctx context.Context, r
|
|||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "SubmitDistributedQueryResults",
|
||||
"ip_addr", ctx.Value(kithttp.ContextKeyRequestRemoteAddr).(string),
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
|
|
@ -105,6 +111,7 @@ func (mw loggingMiddleware) SubmitStatusLogs(ctx context.Context, logs []kolide.
|
|||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "SubmitStatusLogs",
|
||||
"ip_addr", ctx.Value(kithttp.ContextKeyRequestRemoteAddr).(string),
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
|
|
@ -122,6 +129,7 @@ func (mw loggingMiddleware) SubmitResultLogs(ctx context.Context, logs []kolide.
|
|||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "SubmitResultLogs",
|
||||
"ip_addr", ctx.Value(kithttp.ContextKeyRequestRemoteAddr).(string),
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue