Skip to content

Commit

Permalink
添加日志字段"short_message":"k8s-webshell",
Browse files Browse the repository at this point in the history
  • Loading branch information
richie committed Jun 26, 2019
1 parent 33dfa17 commit 3ceec34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/api/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func (handler *streamHandler) RecordCommand(inputString *string) {
"PodName": handler.podName,
"NameSpace": handler.podNs,
"serviceName":"k8s-webshell",
"short_message":"k8s-webshell",
"command": "clear screen",
}).Info("record input")

Expand All @@ -140,6 +141,7 @@ func (handler *streamHandler) RecordCommand(inputString *string) {
"PodName": handler.podName,
"NameSpace": handler.podNs,
"serviceName": "k8s-webshell",
"short_message":"k8s-webshell",
"command": handler.logBuff.String(),
}).Info("record input")
}
Expand All @@ -160,6 +162,7 @@ func (handler *streamHandler) RecordCommand(inputString *string) {
"PodName": handler.podName,
"NameSpace": handler.podNs,
"serviceName": "k8s-webshell",
"short_message":"k8s-webshell",
"command": "ctrl + c",
}).Info("record input")
handler.logBuff.Reset()
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func GinRus(logger loggerEntryWithfields, timeFormat string, utc bool) gin.Handl

entry := logger.WithFields(logrus.Fields{
"serviceName": "k8s-webshell",
"short_message":"k8s-webshell",
"status": c.Writer.Status(),
"method": c.Request.Method,
"path": requestPath,
Expand Down

0 comments on commit 3ceec34

Please sign in to comment.