Log Drains
Create a log drain
Creates a new log drain to forward job execution logs to an external destination.
POST
/
v1
/
log-drains
Create a log drain
curl --request POST \
--url https://api.strait.dev/v1/log-drains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"auth_type": "<string>",
"drain_type": "<string>",
"endpoint_url": "<string>",
"name": "<string>",
"project_id": "<string>",
"auth_config": {},
"enabled": true,
"level_filter": [
"<string>"
]
}
'import requests
url = "https://api.strait.dev/v1/log-drains"
payload = {
"auth_type": "<string>",
"drain_type": "<string>",
"endpoint_url": "<string>",
"name": "<string>",
"project_id": "<string>",
"auth_config": {},
"enabled": True,
"level_filter": ["<string>"]
}
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({
auth_type: '<string>',
drain_type: '<string>',
endpoint_url: '<string>',
name: '<string>',
project_id: '<string>',
auth_config: {},
enabled: true,
level_filter: ['<string>']
})
};
fetch('https://api.strait.dev/v1/log-drains', 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.strait.dev/v1/log-drains",
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([
'auth_type' => '<string>',
'drain_type' => '<string>',
'endpoint_url' => '<string>',
'name' => '<string>',
'project_id' => '<string>',
'auth_config' => [
],
'enabled' => true,
'level_filter' => [
'<string>'
]
]),
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.strait.dev/v1/log-drains"
payload := strings.NewReader("{\n \"auth_type\": \"<string>\",\n \"drain_type\": \"<string>\",\n \"endpoint_url\": \"<string>\",\n \"name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"auth_config\": {},\n \"enabled\": true,\n \"level_filter\": [\n \"<string>\"\n ]\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.strait.dev/v1/log-drains")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"auth_type\": \"<string>\",\n \"drain_type\": \"<string>\",\n \"endpoint_url\": \"<string>\",\n \"name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"auth_config\": {},\n \"enabled\": true,\n \"level_filter\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strait.dev/v1/log-drains")
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 \"auth_type\": \"<string>\",\n \"drain_type\": \"<string>\",\n \"endpoint_url\": \"<string>\",\n \"name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"auth_config\": {},\n \"enabled\": true,\n \"level_filter\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"auth_type": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"drain_type": "<string>",
"enabled": true,
"endpoint_url": "<string>",
"id": "<string>",
"name": "<string>",
"project_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"$schema": "<string>",
"auth_config": {},
"level_filter": [
"<string>"
]
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}Authorizations
API key passed as Bearer token
Body
application/json
Response
OK
A URL to the JSON Schema for this object.
Example:
"https://api.strait.dev/schemas/LogDrain.json"
Show child attributes
Show child attributes
⌘I
Create a log drain
curl --request POST \
--url https://api.strait.dev/v1/log-drains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"auth_type": "<string>",
"drain_type": "<string>",
"endpoint_url": "<string>",
"name": "<string>",
"project_id": "<string>",
"auth_config": {},
"enabled": true,
"level_filter": [
"<string>"
]
}
'import requests
url = "https://api.strait.dev/v1/log-drains"
payload = {
"auth_type": "<string>",
"drain_type": "<string>",
"endpoint_url": "<string>",
"name": "<string>",
"project_id": "<string>",
"auth_config": {},
"enabled": True,
"level_filter": ["<string>"]
}
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({
auth_type: '<string>',
drain_type: '<string>',
endpoint_url: '<string>',
name: '<string>',
project_id: '<string>',
auth_config: {},
enabled: true,
level_filter: ['<string>']
})
};
fetch('https://api.strait.dev/v1/log-drains', 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.strait.dev/v1/log-drains",
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([
'auth_type' => '<string>',
'drain_type' => '<string>',
'endpoint_url' => '<string>',
'name' => '<string>',
'project_id' => '<string>',
'auth_config' => [
],
'enabled' => true,
'level_filter' => [
'<string>'
]
]),
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.strait.dev/v1/log-drains"
payload := strings.NewReader("{\n \"auth_type\": \"<string>\",\n \"drain_type\": \"<string>\",\n \"endpoint_url\": \"<string>\",\n \"name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"auth_config\": {},\n \"enabled\": true,\n \"level_filter\": [\n \"<string>\"\n ]\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.strait.dev/v1/log-drains")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"auth_type\": \"<string>\",\n \"drain_type\": \"<string>\",\n \"endpoint_url\": \"<string>\",\n \"name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"auth_config\": {},\n \"enabled\": true,\n \"level_filter\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strait.dev/v1/log-drains")
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 \"auth_type\": \"<string>\",\n \"drain_type\": \"<string>\",\n \"endpoint_url\": \"<string>\",\n \"name\": \"<string>\",\n \"project_id\": \"<string>\",\n \"auth_config\": {},\n \"enabled\": true,\n \"level_filter\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"auth_type": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"drain_type": "<string>",
"enabled": true,
"endpoint_url": "<string>",
"id": "<string>",
"name": "<string>",
"project_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"$schema": "<string>",
"auth_config": {},
"level_filter": [
"<string>"
]
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}{
"$schema": "<string>",
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}