Update metric config
curl --request PUT \
--url https://api.logfleet.io/api/v1/metric-configs/{configId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 123,
"name": "<string>",
"description": "<string>",
"enabled": true,
"scope": {
"locations": [
"<string>"
],
"tags": [
"<string>"
]
}
}
'import requests
url = "https://api.logfleet.io/api/v1/metric-configs/{configId}"
payload = {
"version": 123,
"name": "<string>",
"description": "<string>",
"enabled": True,
"scope": {
"locations": ["<string>"],
"tags": ["<string>"]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
version: 123,
name: '<string>',
description: '<string>',
enabled: true,
scope: {locations: ['<string>'], tags: ['<string>']}
})
};
fetch('https://api.logfleet.io/api/v1/metric-configs/{configId}', 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.logfleet.io/api/v1/metric-configs/{configId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'version' => 123,
'name' => '<string>',
'description' => '<string>',
'enabled' => true,
'scope' => [
'locations' => [
'<string>'
],
'tags' => [
'<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.logfleet.io/api/v1/metric-configs/{configId}"
payload := strings.NewReader("{\n \"version\": 123,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.logfleet.io/api/v1/metric-configs/{configId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 123,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.logfleet.io/api/v1/metric-configs/{configId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 123,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"version": 123,
"enabled": true,
"scope": {
"locations": [
"<string>"
],
"tags": [
"<string>"
]
},
"metrics": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"namespace": "<string>",
"description": "<string>",
"enabled": true,
"source_field": "<string>",
"filter": {
"field": "<string>",
"value": "<string>",
"conditions": "<array>"
},
"tags": [
{
"name": "<string>",
"value": "<string>"
}
],
"counter_opts": {
"increment_by": "<string>"
},
"gauge_opts": {
"value_field": "<string>"
},
"histogram_opts": {
"value_field": "<string>",
"buckets": [
123
]
},
"cardinality": {
"max_tag_cardinality": 1000,
"on_limit_exceeded": "drop"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Metric Configs
Update Metric Config
Update a metric config. Requires version for optimistic locking.
PUT
/
api
/
v1
/
metric-configs
/
{configId}
Update metric config
curl --request PUT \
--url https://api.logfleet.io/api/v1/metric-configs/{configId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 123,
"name": "<string>",
"description": "<string>",
"enabled": true,
"scope": {
"locations": [
"<string>"
],
"tags": [
"<string>"
]
}
}
'import requests
url = "https://api.logfleet.io/api/v1/metric-configs/{configId}"
payload = {
"version": 123,
"name": "<string>",
"description": "<string>",
"enabled": True,
"scope": {
"locations": ["<string>"],
"tags": ["<string>"]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
version: 123,
name: '<string>',
description: '<string>',
enabled: true,
scope: {locations: ['<string>'], tags: ['<string>']}
})
};
fetch('https://api.logfleet.io/api/v1/metric-configs/{configId}', 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.logfleet.io/api/v1/metric-configs/{configId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'version' => 123,
'name' => '<string>',
'description' => '<string>',
'enabled' => true,
'scope' => [
'locations' => [
'<string>'
],
'tags' => [
'<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.logfleet.io/api/v1/metric-configs/{configId}"
payload := strings.NewReader("{\n \"version\": 123,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.logfleet.io/api/v1/metric-configs/{configId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 123,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.logfleet.io/api/v1/metric-configs/{configId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 123,\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"enabled\": true,\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"version": 123,
"enabled": true,
"scope": {
"locations": [
"<string>"
],
"tags": [
"<string>"
]
},
"metrics": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"config_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"namespace": "<string>",
"description": "<string>",
"enabled": true,
"source_field": "<string>",
"filter": {
"field": "<string>",
"value": "<string>",
"conditions": "<array>"
},
"tags": [
{
"name": "<string>",
"value": "<string>"
}
],
"counter_opts": {
"increment_by": "<string>"
},
"gauge_opts": {
"value_field": "<string>"
},
"histogram_opts": {
"value_field": "<string>",
"buckets": [
123
]
},
"cardinality": {
"max_tag_cardinality": 1000,
"on_limit_exceeded": "drop"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Updates use optimistic locking. Include the current
version in your request.
If the version doesn’t match, you’ll receive a 409 Conflict error.Authorizations
JWT token obtained from /auth/login
Path Parameters
Metric config ID
Body
application/json
⌘I