Create metric config
curl --request POST \
--url https://api.logfleet.io/api/v1/metric-configs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scope": {
"locations": [
"<string>"
],
"tags": [
"<string>"
]
},
"description": "<string>",
"metrics": [
{
"name": "<string>",
"source_field": "<string>",
"namespace": "edge",
"description": "<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"
}
}
]
}
'import requests
url = "https://api.logfleet.io/api/v1/metric-configs"
payload = {
"name": "<string>",
"scope": {
"locations": ["<string>"],
"tags": ["<string>"]
},
"description": "<string>",
"metrics": [
{
"name": "<string>",
"source_field": "<string>",
"namespace": "edge",
"description": "<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"
}
}
]
}
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>',
scope: {locations: ['<string>'], tags: ['<string>']},
description: '<string>',
metrics: [
{
name: '<string>',
source_field: '<string>',
namespace: 'edge',
description: '<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'}
}
]
})
};
fetch('https://api.logfleet.io/api/v1/metric-configs', 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",
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>',
'scope' => [
'locations' => [
'<string>'
],
'tags' => [
'<string>'
]
],
'description' => '<string>',
'metrics' => [
[
'name' => '<string>',
'source_field' => '<string>',
'namespace' => 'edge',
'description' => '<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'
]
]
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"source_field\": \"<string>\",\n \"namespace\": \"edge\",\n \"description\": \"<string>\",\n \"filter\": {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"conditions\": \"<array>\"\n },\n \"tags\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"counter_opts\": {\n \"increment_by\": \"<string>\"\n },\n \"gauge_opts\": {\n \"value_field\": \"<string>\"\n },\n \"histogram_opts\": {\n \"value_field\": \"<string>\",\n \"buckets\": [\n 123\n ]\n },\n \"cardinality\": {\n \"max_tag_cardinality\": 1000,\n \"on_limit_exceeded\": \"drop\"\n }\n }\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.logfleet.io/api/v1/metric-configs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"source_field\": \"<string>\",\n \"namespace\": \"edge\",\n \"description\": \"<string>\",\n \"filter\": {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"conditions\": \"<array>\"\n },\n \"tags\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"counter_opts\": {\n \"increment_by\": \"<string>\"\n },\n \"gauge_opts\": {\n \"value_field\": \"<string>\"\n },\n \"histogram_opts\": {\n \"value_field\": \"<string>\",\n \"buckets\": [\n 123\n ]\n },\n \"cardinality\": {\n \"max_tag_cardinality\": 1000,\n \"on_limit_exceeded\": \"drop\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.logfleet.io/api/v1/metric-configs")
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 \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"source_field\": \"<string>\",\n \"namespace\": \"edge\",\n \"description\": \"<string>\",\n \"filter\": {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"conditions\": \"<array>\"\n },\n \"tags\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"counter_opts\": {\n \"increment_by\": \"<string>\"\n },\n \"gauge_opts\": {\n \"value_field\": \"<string>\"\n },\n \"histogram_opts\": {\n \"value_field\": \"<string>\",\n \"buckets\": [\n 123\n ]\n },\n \"cardinality\": {\n \"max_tag_cardinality\": 1000,\n \"on_limit_exceeded\": \"drop\"\n }\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>"
}Metric Configs
Create Metric Config
Create a new metric extraction configuration
POST
/
api
/
v1
/
metric-configs
Create metric config
curl --request POST \
--url https://api.logfleet.io/api/v1/metric-configs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scope": {
"locations": [
"<string>"
],
"tags": [
"<string>"
]
},
"description": "<string>",
"metrics": [
{
"name": "<string>",
"source_field": "<string>",
"namespace": "edge",
"description": "<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"
}
}
]
}
'import requests
url = "https://api.logfleet.io/api/v1/metric-configs"
payload = {
"name": "<string>",
"scope": {
"locations": ["<string>"],
"tags": ["<string>"]
},
"description": "<string>",
"metrics": [
{
"name": "<string>",
"source_field": "<string>",
"namespace": "edge",
"description": "<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"
}
}
]
}
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>',
scope: {locations: ['<string>'], tags: ['<string>']},
description: '<string>',
metrics: [
{
name: '<string>',
source_field: '<string>',
namespace: 'edge',
description: '<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'}
}
]
})
};
fetch('https://api.logfleet.io/api/v1/metric-configs', 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",
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>',
'scope' => [
'locations' => [
'<string>'
],
'tags' => [
'<string>'
]
],
'description' => '<string>',
'metrics' => [
[
'name' => '<string>',
'source_field' => '<string>',
'namespace' => 'edge',
'description' => '<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'
]
]
]
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"source_field\": \"<string>\",\n \"namespace\": \"edge\",\n \"description\": \"<string>\",\n \"filter\": {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"conditions\": \"<array>\"\n },\n \"tags\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"counter_opts\": {\n \"increment_by\": \"<string>\"\n },\n \"gauge_opts\": {\n \"value_field\": \"<string>\"\n },\n \"histogram_opts\": {\n \"value_field\": \"<string>\",\n \"buckets\": [\n 123\n ]\n },\n \"cardinality\": {\n \"max_tag_cardinality\": 1000,\n \"on_limit_exceeded\": \"drop\"\n }\n }\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.logfleet.io/api/v1/metric-configs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"source_field\": \"<string>\",\n \"namespace\": \"edge\",\n \"description\": \"<string>\",\n \"filter\": {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"conditions\": \"<array>\"\n },\n \"tags\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"counter_opts\": {\n \"increment_by\": \"<string>\"\n },\n \"gauge_opts\": {\n \"value_field\": \"<string>\"\n },\n \"histogram_opts\": {\n \"value_field\": \"<string>\",\n \"buckets\": [\n 123\n ]\n },\n \"cardinality\": {\n \"max_tag_cardinality\": 1000,\n \"on_limit_exceeded\": \"drop\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.logfleet.io/api/v1/metric-configs")
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 \"scope\": {\n \"locations\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"metrics\": [\n {\n \"name\": \"<string>\",\n \"source_field\": \"<string>\",\n \"namespace\": \"edge\",\n \"description\": \"<string>\",\n \"filter\": {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"conditions\": \"<array>\"\n },\n \"tags\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"counter_opts\": {\n \"increment_by\": \"<string>\"\n },\n \"gauge_opts\": {\n \"value_field\": \"<string>\"\n },\n \"histogram_opts\": {\n \"value_field\": \"<string>\",\n \"buckets\": [\n 123\n ]\n },\n \"cardinality\": {\n \"max_tag_cardinality\": 1000,\n \"on_limit_exceeded\": \"drop\"\n }\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>"
}Authorizations
JWT token obtained from /auth/login
Body
application/json
⌘I