Skip to content

Log remote IP for executed commands

Stan Hu requested to merge sh-log-remote-ip into master

Admins may want to know what client IP originated the request. This commit adds a remote_ip field to the log that extracts the IP address from the SSH_CONNECTION environment variable.

Closes #199 (closed)

Example output

{
  "command": "git-upload-pack",
  "git_protocol": "",
  "gl_project_path": "root/test",
  "gl_repository": "project-261",
  "level": "info",
  "msg": "executing git command",
  "remote_ip": "18.245.1.50",
  "time": "2020-07-20T15:20:08-05:00",
  "user_id": "user-1",
  "username": "root"
}
Edited by Stan Hu

Merge request reports