2020-03-04 22:10:58 +00:00
# Logs
The log file is a stream of JSON structs. Each struct has a `sender` field that identifies the log type.
The logs can be divided into the following categories:
- **"app logs"**, internal logs used to debug SFTPGo:
2020-06-15 21:46:11 +00:00
- `sender` string. This is generally the package name that emits the log
- `time` string. Date/time with millisecond precision
- `level` string
- `message` string
2020-03-04 22:10:58 +00:00
- **"transfer logs"**, SFTP/SCP transfer logs:
2020-06-15 21:46:11 +00:00
- `sender` string. `Upload` or `Download`
- `time` string. Date/time with millisecond precision
- `level` string
2021-07-25 07:55:14 +00:00
- `local_addr` string. IP/port of the local address the connection arrived on. For FTP protocol this is the address for the control connection. For example `127.0.0.1:1234`
2021-06-01 20:28:43 +00:00
- `remote_addr` string. IP and, optionally, port of the remote client. For example `127.0.0.1:1234` or `127.0.0.1`
2020-06-15 21:46:11 +00:00
- `elapsed_ms` , int64. Elapsed time, as milliseconds, for the upload/download
- `size_bytes` , int64. Size, as bytes, of the download/upload
- `username` , string
- `file_path` string
- `connection_id` string. Unique connection identifier
2022-12-27 17:51:53 +00:00
- `protocol` string. `SFTP` , `SCP` , `SSH` , `FTP` , `HTTP` , `DAV` , `DataRetention` , `EventAction`
2021-08-10 11:07:38 +00:00
- `ftp_mode` , string. `active` or `passive` . Included only for `FTP` protocol
2020-03-04 22:10:58 +00:00
- **"command logs"**, SFTP/SCP command logs:
2022-12-27 17:51:53 +00:00
- `sender` string. `Rename` , `Rmdir` , `Mkdir` , `Symlink` , `Remove` , `Chmod` , `Chown` , `Chtimes` , `Truncate` , `Copy` , `SSHCommand`
2020-06-15 21:46:11 +00:00
- `level` string
2021-07-24 18:11:17 +00:00
- `local_addr` string. IP/port of the local address the connection arrived on. For example `127.0.0.1:1234`
2021-06-01 20:28:43 +00:00
- `remote_addr` string. IP and, optionally, port of the remote client. For example `127.0.0.1:1234` or `127.0.0.1`
2020-06-15 21:46:11 +00:00
- `username` , string
- `file_path` string
- `target_path` string
- `filemode` string. Valid for sender `Chmod` otherwise empty
- `uid` integer. Valid for sender `Chown` otherwise -1
- `gid` integer. Valid for sender `Chown` otherwise -1
- `access_time` datetime as YYYY-MM-DDTHH:MM:SS. Valid for sender `Chtimes` otherwise empty
- `modification_time` datetime as YYYY-MM-DDTHH:MM:SS. Valid for sender `Chtimes` otherwise empty
2020-08-20 11:54:36 +00:00
- `size` int64. Valid for sender `Truncate` otherwise -1
2023-02-12 17:56:53 +00:00
- `elapsed` , int64. Elapsed time, as milliseconds
2020-06-15 21:46:11 +00:00
- `ssh_command` , string. Valid for sender `SSHCommand` otherwise empty
- `connection_id` string. Unique connection identifier
2022-12-27 17:51:53 +00:00
- `protocol` string. `SFTP` , `SCP` , `SSH` , `FTP` , `HTTP` , `DAV` , `DataRetention` , `EventAction`
2020-03-04 22:10:58 +00:00
- **"http logs"**, REST API logs:
2020-06-15 21:46:11 +00:00
- `sender` string. `httpd`
- `level` string
2021-07-24 18:11:17 +00:00
- `local_addr` string. IP/port of the local address the connection arrived on. For example `127.0.0.1:1234`
2021-06-01 20:28:43 +00:00
- `remote_addr` string. IP and, optionally, port of the remote client. For example `127.0.0.1:1234` or `127.0.0.1`
2020-06-15 21:46:11 +00:00
- `proto` string, for example `HTTP/1.1`
- `method` string. HTTP method (`GET`, `POST` , `PUT` , `DELETE` etc.)
- `user_agent` string
- `uri` string. Full uri
- `resp_status` integer. HTTP response status code
- `resp_size` integer. Size in bytes of the HTTP response
- `elapsed_ms` int64. Elapsed time, as milliseconds, to complete the request
- `request_id` string. Unique request identifier
2020-03-04 22:10:58 +00:00
- **"connection failed logs"**, logs for failed attempts to initialize a connection. A connection can fail for an authentication error or other errors such as a client abort or a timeout if the login does not happen in two minutes
2020-06-15 21:46:11 +00:00
- `sender` string. `connection_failed`
- `level` string
- `username` , string. Can be empty if the connection is closed before an authentication attempt
- `client_ip` string.
2020-08-12 14:15:12 +00:00
- `protocol` string. Possible values are `SSH` , `FTP` , `DAV`
2020-07-24 21:39:38 +00:00
- `login_type` string. Can be `publickey` , `password` , `keyboard-interactive` , `publickey+password` , `publickey+keyboard-interactive` or `no_auth_tryed`
2020-06-15 21:46:11 +00:00
- `error` string. Optional error description