Create a new PostgreSQL log destination
curl --request POST \
--url https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"url": "<string>",
"options": {}
}
'import requests
url = "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination"
payload = {
"name": "<string>",
"url": "<string>",
"options": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', url: '<string>', options: {}})
};
fetch('https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'url' => '<string>',
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"options\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"options\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "1d000000000000000000000000",
"name": "<string>",
"type": "otlp",
"url": "<string>"
}{
"error": {
"code": 401,
"message": "There was an error logging in",
"type": "InvalidCredentials",
"details": {}
}
}Postgres Log Destination
Create a new PostgreSQL log destination
POST
/
project
/
{project_id}
/
location
/
{location}
/
postgres
/
{postgres_database_reference}
/
log-destination
Create a new PostgreSQL log destination
curl --request POST \
--url https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"url": "<string>",
"options": {}
}
'import requests
url = "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination"
payload = {
"name": "<string>",
"url": "<string>",
"options": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', url: '<string>', options: {}})
};
fetch('https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'url' => '<string>',
'options' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"options\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"options\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ubicloud.com/project/{project_id}/location/{location}/postgres/{postgres_database_reference}/log-destination")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"options\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "1d000000000000000000000000",
"name": "<string>",
"type": "otlp",
"url": "<string>"
}{
"error": {
"code": 401,
"message": "There was an error logging in",
"type": "InvalidCredentials",
"details": {}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The Ubicloud location/region
Example:
"eu-central-h1"
Postgres database ID or name Resource ID or name
Pattern:
^[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?$ID of the project
Pattern:
^pj[0-9a-hj-km-np-tv-z]{24}$Example:
"pjkkmx0f2vke4h36nk9cm8v8q0"
Body
application/json
Name for the Log Destination
Destination type. "otlp" sends via OTLP HTTP (https://...); "syslog" sends via RFC 5424 over TLS (tcp://host:port)
Available options:
otlp, syslog Endpoint URL. For otlp: https://... For syslog: tcp://host:port
Authentication options. For otlp: {"headers": {"Header-Name": "value"}}. For syslog: {"structured_data": {"sd-id": {"key": "value"}}}
Response
A Postgres Log Destination