log ssh commands in "command logs" category

This commit is contained in:
Nicola Murino
2019-11-19 11:38:39 +01:00
parent 9c4dbbc3f8
commit b3729e4666
5 changed files with 41 additions and 35 deletions

View File

@@ -149,8 +149,8 @@ func TransferLog(operation string, path string, elapsed int64, size int64, user
Msg("")
}
// CommandLog logs an SFTP/SCP command
func CommandLog(command, path, target, user, fileMode, connectionID, protocol string, uid, gid int, atime, mtime string) {
// CommandLog logs an SFTP/SCP/SSH command
func CommandLog(command, path, target, user, fileMode, connectionID, protocol string, uid, gid int, atime, mtime, sshCommand string) {
logger.Info().
Timestamp().
Str("sender", command).
@@ -162,6 +162,7 @@ func CommandLog(command, path, target, user, fileMode, connectionID, protocol st
Int("gid", gid).
Str("access_time", atime).
Str("modification_time", atime).
Str("ssh_command", sshCommand).
Str("connection_id", connectionID).
Str("protocol", protocol).
Msg("")