Contents
On this page
Create Mirror - Plugixa Activity Log
POST /plugixa-activity-log/v1/mirrors
Create a mirror: a place every new event matching its filters is also sent to.
Needs settings access (see who can call what). Needs Plugixa Activity Log Pro, with the Mirrors module on under Plugixa Activity Log -> Monitors.
Request
POST https://your-site.example/wp-json/plugixa-activity-log/v1/mirrors
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Must not be blank. Cut to 191 characters. |
type |
string |
Yes | syslog, http or file. Cannot be changed afterwards. |
enabled |
boolean |
No | Defaults to true. Only true, 1, "1" and "true" count as on. |
config |
object |
Depends | What the type needs: see below. |
filters |
object |
No | min_severity (informational, low, medium, high or critical) and groups (event group keys). Left out or empty, every event is sent. |
A site can have at most 20 mirrors. The mirror is recorded in the log as event 9501.
Config
type |
Field | Description |
|---|---|---|
syslog |
host |
Required. A host name or IP address. This machine and private network addresses are refused unless the site allows them for mirrors (meta.allow_private on List Mirrors). |
syslog |
port |
1 to 65535. Defaults to 514. |
syslog |
transport |
udp (the default), tcp or tls. Anything else becomes udp. |
http |
url |
Required. An https:// address that is not this machine or a private network address. Events are sent to it as a JSON POST. |
http |
token |
Optional. Sent as Authorization: Bearer <token> with each delivery. At most 500 characters. |
file |
keep_days |
1 to 365, defaults to 14. One file is written per day and deleted after this many days. |
A file mirror also gets a random key, made for you. A host name is checked for its shape when saved; it is resolved when events are sent.
{
"name": "Central syslog",
"type": "syslog",
"config": { "host": "logs.example.com", "port": 6514, "transport": "tls" },
"filters": { "min_severity": "low" }
}
Responses
201 Created. data is the new mirror.
{
"success": true,
"data": {
"id": 2,
"name": "Central syslog",
"type": "syslog",
"enabled": true,
"config": { "host": "logs.example.com", "port": 6514, "transport": "tls" },
"filters": { "min_severity": "low", "groups": [] },
"created_by": 1,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 09:30:00"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The new mirror’s id |
data.config |
object |
The config as stored. An http token is masked, with has_token beside it |
data.filters |
object |
Always both keys: min_severity (empty for none) and groups |
data.created_at |
string |
UTC datetime |
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_activity_log_invalid |
name is blank, type is not one of the three, the site already has 20 mirrors, a syslog host is missing, or port is out of range. |
422 |
plugixa_activity_log_unsafe_destination |
The URL is not valid or not https://, the host name is not valid, or it points at this machine or a private network. |
500 |
plugixa_activity_log_save_failed |
The mirror could not be saved. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-activity-log/v1/mirrors" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Central syslog","type":"syslog","config":{"host":"logs.example.com","port":6514,"transport":"tls"},"filters":{"min_severity":"low"}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-activity-log/v1/mirrors');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Central syslog',
'type' => 'syslog',
'config' => ['host' => 'logs.example.com', 'port' => 6514, 'transport' => 'tls'],
'filters' => ['min_severity' => 'low'],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-activity-log/v1/mirrors', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Central syslog',
type: 'syslog',
config: { host: 'logs.example.com', port: 6514, transport: 'tls' },
filters: { min_severity: 'low' },
}),
});
const { data } = await response.json();
Quick Links
Share