Start a conversation

Server Logging

The self-hosted instance sends logs out using stdout logger.

However when production mode is enabled (environment PRODUCTION=1) the server will output logs to stdout using a JSON format to be pushed into a log parser such as Cloudwatch, Azure Monitor, Stackdriver or Elasticsearch.

Below is an example of a the log when starting the server in production mode

{"level":"info","msg":"DocEvent.io Server Version: 0.1.7+165230a","time":"2019-05-09T13:57:11+10:00","version":"0.1.7+165230a"}
{"level":"info","msg":"Starting Self-Hosted Server","time":"2019-05-09T13:57:11+10:00"}
{"TLSCERT":"/Users/mariusz/work/docevent/sfs-server/certificate.cert","TLSKEY":"/Users/mariusz/work/docevent/sfs-server/certificate.key","level":"info","msg":"TLS configuration","time":"2019-05-09T13:57:12+10:00"}
{"PRIVATEKEYFILE":"/Users/mariusz/work/docevent/sfs-server/id_rsa","level":"info","msg":"SSH configuration","time":"2019-05-09T13:57:12+10:00"}
{"PASSIVEPORTS21":"2030-2039","PORT21":2021,"level":"info","msg":"Explicit FTP Port configuration","time":"2019-05-09T13:57:12+10:00"}
{"PASSIVEPORTS990":"2040-2049","PORT990":9990,"level":"info","msg":"Implicit Port configuration","time":"2019-05-09T13:57:12+10:00"}
{"PORT22":2022,"level":"info","msg":"SSH port configuration","time":"2019-05-09T13:57:12+10:00"}
{"PUBLICIP":"127.0.0.1","level":"info","msg":"Public IP address","time":"2019-05-09T13:57:12+10:00"}
{"WELCOME":"127.0.0.1","level":"info","msg":"Welcome message","time":"2019-05-09T13:57:12+10:00"}
{"SHUTDOWNWINDOW":"127.0.0.1","level":"info","msg":"Shutdown window","time":"2019-05-09T13:57:12+10:00"}
{"level":"info","machineid":"74ce2ff5-92da-5753-b251-2dafa5cb7f1f","msg":"Got machine ID","time":"2019-05-09T13:57:12+10:00"}
{"level":"info","msg":"Starting Servers","service":"ftps","time":"2019-05-09T13:57:12+10:00"}
{"level":"info","msg":"SSH Fingerprint (SHA256)","service":"sftp","sha256":"SHA256:tVaslnFvXb5jpOpYRzKQg5Px4px+5ibh58BLWU6NTU8","time":"2019-05-09T13:57:12+10:00"}
{"level":"info","md5":"eb:f0:2c:3d:68:60:88:b7:0d:8c:94:76:4a:af:fd:93","msg":"SSH Fingerprint (MD5)","service":"sftp","time":"2019-05-09T13:57:12+10:00"}
{"address":"[::]:2022","level":"info","msg":"Go SFTP server listening","service":"sftp","time":"2019-05-09T13:57:12+10:00"}
{"level":"info","msg":"You are on the latest version :)","time":"2019-05-09T13:57:13+10:00"}
{"level":"info","method":"receiveSetSfsConfigMessage","msg":"SFS configuration loaded successfuly","time":"2019-05-09T13:57:15+10:00"}

When a user logs in and performs transactions the following log entry will be created

{"bytes":0,"level":"info","msg":"","operation":"login","path_prefix":"","protocol":"sftp","session_id":"501bbb4c6a046417628b","source_ip":"::1","src_location":"","src_path":"","src_version_id":null,"time":"2019-05-09T14:00:16+10:00","transaction":true,"type":"login","user.home":"/","user.sub":"d1b9cea8-bc5f-454e-94d6-0b57476554ee","user.username":"root","user.uuid":"ixxvwd0z"}
{"bytes":22,"level":"info","msg":"","operation":"get","path_prefix":"/","protocol":"sftp","session_id":"501bbb4c6a046417628b","source_ip":"","src_location":"testfile1","src_path":"/testfile1","src_version_id":null,"time":"2019-05-09T14:00:22+10:00","transaction":true,"type":"get","user.home":"/","user.sub":"d1b9cea8-bc5f-454e-94d6-0b57476554ee","user.username":"root","user.uuid":"ixxvwd0z"}

The above shows 2 log entries:

  1. The users login entry, identified by "operation": "login"
  2. The user downloads a file, identified by "operation": "get"

Both the above transactions can be differentiated from regular server logs because they contain the "transaction": true field.



Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Mariusz

  2. Posted
  3. Updated

Comments