Log file management

Note

All log file management operations require admin rights.

Retrieve a list of available log files

GET /api/logs

Retrieve information regarding all log files currently available and regarding the disk space still available in the system on the location the log files are being stored.

Returns a Logfile Retrieve response.

Example

GET /api/logs HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
HTTP/1.1 200 OK
Content-Type: application/json

{
  "files" : [
    {
      "date" : 1393158814,
      "name" : "octoprint.log",
      "size" : 43712,
      "refs": {
        "resource": "http://example.com/api/logs/octoprint.log",
        "download": "http://example.com/downloads/logs/octoprint.log"
      }
    },
    {
      "date" : 1392628936,
      "name" : "octoprint.log.2014-02-17",
      "size" : 13205,
      "refs": {
        "resource": "http://example.com/api/logs/octoprint.log.2014-02-17",
        "download": "http://example.com/downloads/logs/octoprint.log.2014-02-17"
      }
    },
    {
      "date" : 1393158814,
      "name" : "serial.log",
      "size" : 1798419,
      "refs": {
        "resource": "http://example.com/api/logs/serial.log",
        "download": "http://example.com/downloads/logs/serial.log"
      }
    }
  ],
  "free": 12237201408
}
Status Codes:
  • 200 OK – No error
  • 403 Forbidden – If the given API token did not have admin rights associated with it

Delete a specific logfile

DELETE /api/logs/(path: filename)

Delete the selected log file with name filename.

Returns a 204 No Content after successful deletion.

Example Request

DELETE /api/logs/octoprint.log.2014-02-17 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Parameters:
  • filename – The filename of the log file to delete
Status Codes:

Datamodel

Logfile Retrieve Response

Name Multiplicity Type Description
files 0..* Array of File information items The list of requested files. Might be an empty list if no files are available
free 1 String The amount of disk space in bytes available in the local disk space (refers to OctoPrint’s logs folder).

File information

Name Multiplicity Type Description
name 1 String The name of the file
size 1 Number The size of the file in bytes.
date 1 Unix timestamp The timestamp when this file was last modified.
refs 1 References References relevant to this file

References

Name Multiplicity Type Description
resource 1 URL The resource that represents the file (e.g. for deleting)
download 1 URL The download URL for the file