Log Multiple Messages

If you would like to write messages to the Plex log to record events that happen, you can use this API command to write a multiple messages to the log. The messages will include the log level, message and the source of each message.

This API command is an efficient way of writing to the log as only one request is required to log multiple messages.

URL

POST http://{ip_address}:32400/log?X-Plex-Token={plex_token}

Parameters

NameDescription
ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex user token.

Return Status

HTTP CodeDescription
200Success - The request was successful.
400Bad request - A parameter is missing.
401Unauthorized - The Plex token provided is not valid.

Response

No response is returned by the command. The status code will indicate whether the log was written successfully.

Remarks

The log message specified using this API command will be displayed in the Plex Media Server console as well as the log file located in the data directory.

The logging information to be written is specified in the body of the request. The body is sent as a text and contains all the parameters for each log line to be written.

The parameters in the body are the same as those specified when logging a single message to the log.

For example, the following body text will write two messages to the log file:

level=0&message=Error%20message&source=computer1&level=1&message=Warning%20message&message&source=computer2

The first message will show as an error with the message "Error message" from "computer1" in the log. The second message will show a warning with the message "Warning message" from "computer2" in the log.

You can append as many log messages as you would like to the body of the request.

The source parameter can be any value, such as the name of the application.

Ensure the message and source parameters are properly HTML encoded to ensure the values are parsed correctly.

Log level

There are several different values of log level that can be specified for this command. The table below lists the name and value for each level.

Log levels.
NameValue
Error0
Warning1
Info2
Debug3
Verbose4

To set the log level, you would just set the level parameter equal to the value from the above table.

Examples

curl -X POST http://{ip_address}:32400/log?X-Plex-Token={plex_token}
import requests
plex_url = http://{ip_address}:32400/log?X-Plex-Token={plex_token}
response = requests.post(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/log?X-Plex-Token={plex_token}' -Method 'POST'
Write-Output $response

Subscribe
Display