Working with log files
You can use the REST interface to work with log files on any appliance in a cluster that includes the appliance where you are currently working.
When working with log files, you include the appliances parameter and identify an appliance in all requests.
You also append the log parameter and other parameters as needed to complete particular activities with log files.
With log files, you can:
- Retrieve a list of log files
- Download a log file
- Delete a log file
Retrieving a list of log files
Request formats
<URL>/appliances/<UUID>/log
<URL>/appliances/<UUID>/log?page=<int>&pageSize=<int>
You can retrieve a list of log files on an appliance in a cluster that includes the appliance where you are currently working.
You can request a particular page of the feed that you receive in response and specify the page size.
The feed provides MIME type information in XML format, indicating for every list item whether it is a log file or a directory.
- "application/x-download" — log file
- "application/atom+xml; type=feed" — directory
Sample command
Retrieve a list of log files on an appliance in a cluster that includes the appliance where you are currently working:
curl -i -b cookies.txt -X GET "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC/log"
Variable request parameters
Parameter | Type | Description |
---|---|---|
UUID | String | Universally unique identifier for an appliance Default: None |
page | Integer | Number of a page in a feed with a list of log files Default: 1 |
pageSize | Integer | Size of a page in a feed Default: –1 |
Downloading a log file
Request format
<URL>/appliances/<UUID>/log/<subresources>
You can download a log file from an appliance in a cluster that includes the appliance where you are currently working.
When downloading a log file, you provide its path and name. You must also specify an Accept header.
Using the -O parameter, you can store the downloaded log file as a local file under its name on the appliance where you downloaded it from.
Sample command
Download a log file from an appliance in a cluster that includes the appliance where you are currently working.
curl -b cookies.txt -H "Accept: application/x-download" -X GET "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC/log/debug/debug_1234.log" -O
Variable request parameters
Parameter | Type | Description |
---|---|---|
UUID | String | Universally unique identifier for an appliance Default: None |
subresources | String | Path to a file that is downloaded and file name Default: None |
Deleting a log file
Request format
<URL>/appliances/<UUID>/log/<subresources>
You can delete a log file on an appliance in a cluster that includes the appliance where you are currently working.
When deleting a log file, you provide its path and name.
Sample command
Delete a log file on an appliance in a cluster that includes the appliance where you are currently working.
curl -i -b cookies.txt -X DELETE "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /log/debug/debug_1234.log"
Variable request parameters
Parameter | Type | Description |
---|---|---|
UUID | String | Universally unique identifier for an appliance Default: None |
subresources | String | Path to a file that is deleted and file name Default: None |
Sample script for working with log files
The following bash script deletes a log file on an appliance in a cluster that includes the appliance where you are currently working.
Before performing this operation, the script sets a URL variable for accessing the REST interface.
Log file operations do not require a commit.
#!/bin/bash ## Set URL variable for accessing REST interface REST=http://localhost:4711/Konfigurator/REST ## Log on and authenticate curl -i -c cookies.txt -X POST "$REST/login?userName=myUserName&pass=myPassword" ## Delete log file curl -i -b cookies.txt -X DELETE "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC /log/debug/debug_1234.log" ## Log off curl -b cookies.txt -X POST "$REST/logout"