curl --request PUT \
--url https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2 \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Service_catalog_latency",
"spansQuery": {
"actionFilters": [
"myAction"
],
"applicationnameFilters": [
"myApp"
],
"lucene": "applicationName:myApp",
"serviceFilters": [
"myService"
],
"subsystemnameFilters": [
"mySubsystem"
]
},
"createTime": "2022-06-30T12:30:00.000Z",
"dataSource": "my_namespace/my_dataset",
"description": "avg and max the latency of catalog service",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"isInternal": true,
"logsQuery": {
"alias": "new_query",
"applicationnameFilters": [
"app_name"
],
"lucene": "log_obj.numeric_field: [50 TO 100]",
"severityFilters": [],
"subsystemnameFilters": [
"sub_name"
]
},
"metricFields": [
{
"aggregations": [
{
"none": {},
"enabled": true,
"histogram": {
"buckets": [
2
]
},
"samples": {},
"targetMetricName": "alias_field_name_agg_func"
}
],
"sourceField": "log_obj.numeric_field",
"targetBaseMetricName": "alias_field_name"
}
],
"metricLabels": [
{
"sourceField": "log_obj.string_value",
"targetLabel": "alias_label_name"
}
],
"updateTime": "2022-06-30T12:30:00.000Z"
}
'import requests
url = "https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2"
payload = {
"name": "Service_catalog_latency",
"spansQuery": {
"actionFilters": ["myAction"],
"applicationnameFilters": ["myApp"],
"lucene": "applicationName:myApp",
"serviceFilters": ["myService"],
"subsystemnameFilters": ["mySubsystem"]
},
"createTime": "2022-06-30T12:30:00.000Z",
"dataSource": "my_namespace/my_dataset",
"description": "avg and max the latency of catalog service",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"isInternal": True,
"logsQuery": {
"alias": "new_query",
"applicationnameFilters": ["app_name"],
"lucene": "log_obj.numeric_field: [50 TO 100]",
"severityFilters": [],
"subsystemnameFilters": ["sub_name"]
},
"metricFields": [
{
"aggregations": [
{
"none": {},
"enabled": True,
"histogram": { "buckets": [2] },
"samples": {},
"targetMetricName": "alias_field_name_agg_func"
}
],
"sourceField": "log_obj.numeric_field",
"targetBaseMetricName": "alias_field_name"
}
],
"metricLabels": [
{
"sourceField": "log_obj.string_value",
"targetLabel": "alias_label_name"
}
],
"updateTime": "2022-06-30T12:30:00.000Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Service_catalog_latency',
spansQuery: {
actionFilters: ['myAction'],
applicationnameFilters: ['myApp'],
lucene: 'applicationName:myApp',
serviceFilters: ['myService'],
subsystemnameFilters: ['mySubsystem']
},
createTime: '2022-06-30T12:30:00.000Z',
dataSource: 'my_namespace/my_dataset',
description: 'avg and max the latency of catalog service',
id: 'd6a3658e-78d2-47d0-9b81-b2c551f01b09',
isInternal: true,
logsQuery: {
alias: 'new_query',
applicationnameFilters: ['app_name'],
lucene: 'log_obj.numeric_field: [50 TO 100]',
severityFilters: [],
subsystemnameFilters: ['sub_name']
},
metricFields: [
{
aggregations: [
{
none: {},
enabled: true,
histogram: {buckets: [2]},
samples: {},
targetMetricName: 'alias_field_name_agg_func'
}
],
sourceField: 'log_obj.numeric_field',
targetBaseMetricName: 'alias_field_name'
}
],
metricLabels: [{sourceField: 'log_obj.string_value', targetLabel: 'alias_label_name'}],
updateTime: '2022-06-30T12:30:00.000Z'
})
};
fetch('https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2', 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.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2",
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([
'name' => 'Service_catalog_latency',
'spansQuery' => [
'actionFilters' => [
'myAction'
],
'applicationnameFilters' => [
'myApp'
],
'lucene' => 'applicationName:myApp',
'serviceFilters' => [
'myService'
],
'subsystemnameFilters' => [
'mySubsystem'
]
],
'createTime' => '2022-06-30T12:30:00.000Z',
'dataSource' => 'my_namespace/my_dataset',
'description' => 'avg and max the latency of catalog service',
'id' => 'd6a3658e-78d2-47d0-9b81-b2c551f01b09',
'isInternal' => true,
'logsQuery' => [
'alias' => 'new_query',
'applicationnameFilters' => [
'app_name'
],
'lucene' => 'log_obj.numeric_field: [50 TO 100]',
'severityFilters' => [
],
'subsystemnameFilters' => [
'sub_name'
]
],
'metricFields' => [
[
'aggregations' => [
[
'none' => [
],
'enabled' => true,
'histogram' => [
'buckets' => [
2
]
],
'samples' => [
],
'targetMetricName' => 'alias_field_name_agg_func'
]
],
'sourceField' => 'log_obj.numeric_field',
'targetBaseMetricName' => 'alias_field_name'
]
],
'metricLabels' => [
[
'sourceField' => 'log_obj.string_value',
'targetLabel' => 'alias_label_name'
]
],
'updateTime' => '2022-06-30T12:30:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2"
payload := strings.NewReader("{\n \"name\": \"Service_catalog_latency\",\n \"spansQuery\": {\n \"actionFilters\": [\n \"myAction\"\n ],\n \"applicationnameFilters\": [\n \"myApp\"\n ],\n \"lucene\": \"applicationName:myApp\",\n \"serviceFilters\": [\n \"myService\"\n ],\n \"subsystemnameFilters\": [\n \"mySubsystem\"\n ]\n },\n \"createTime\": \"2022-06-30T12:30:00.000Z\",\n \"dataSource\": \"my_namespace/my_dataset\",\n \"description\": \"avg and max the latency of catalog service\",\n \"id\": \"d6a3658e-78d2-47d0-9b81-b2c551f01b09\",\n \"isInternal\": true,\n \"logsQuery\": {\n \"alias\": \"new_query\",\n \"applicationnameFilters\": [\n \"app_name\"\n ],\n \"lucene\": \"log_obj.numeric_field: [50 TO 100]\",\n \"severityFilters\": [],\n \"subsystemnameFilters\": [\n \"sub_name\"\n ]\n },\n \"metricFields\": [\n {\n \"aggregations\": [\n {\n \"none\": {},\n \"enabled\": true,\n \"histogram\": {\n \"buckets\": [\n 2\n ]\n },\n \"samples\": {},\n \"targetMetricName\": \"alias_field_name_agg_func\"\n }\n ],\n \"sourceField\": \"log_obj.numeric_field\",\n \"targetBaseMetricName\": \"alias_field_name\"\n }\n ],\n \"metricLabels\": [\n {\n \"sourceField\": \"log_obj.string_value\",\n \"targetLabel\": \"alias_label_name\"\n }\n ],\n \"updateTime\": \"2022-06-30T12:30:00.000Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Service_catalog_latency\",\n \"spansQuery\": {\n \"actionFilters\": [\n \"myAction\"\n ],\n \"applicationnameFilters\": [\n \"myApp\"\n ],\n \"lucene\": \"applicationName:myApp\",\n \"serviceFilters\": [\n \"myService\"\n ],\n \"subsystemnameFilters\": [\n \"mySubsystem\"\n ]\n },\n \"createTime\": \"2022-06-30T12:30:00.000Z\",\n \"dataSource\": \"my_namespace/my_dataset\",\n \"description\": \"avg and max the latency of catalog service\",\n \"id\": \"d6a3658e-78d2-47d0-9b81-b2c551f01b09\",\n \"isInternal\": true,\n \"logsQuery\": {\n \"alias\": \"new_query\",\n \"applicationnameFilters\": [\n \"app_name\"\n ],\n \"lucene\": \"log_obj.numeric_field: [50 TO 100]\",\n \"severityFilters\": [],\n \"subsystemnameFilters\": [\n \"sub_name\"\n ]\n },\n \"metricFields\": [\n {\n \"aggregations\": [\n {\n \"none\": {},\n \"enabled\": true,\n \"histogram\": {\n \"buckets\": [\n 2\n ]\n },\n \"samples\": {},\n \"targetMetricName\": \"alias_field_name_agg_func\"\n }\n ],\n \"sourceField\": \"log_obj.numeric_field\",\n \"targetBaseMetricName\": \"alias_field_name\"\n }\n ],\n \"metricLabels\": [\n {\n \"sourceField\": \"log_obj.string_value\",\n \"targetLabel\": \"alias_label_name\"\n }\n ],\n \"updateTime\": \"2022-06-30T12:30:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Service_catalog_latency\",\n \"spansQuery\": {\n \"actionFilters\": [\n \"myAction\"\n ],\n \"applicationnameFilters\": [\n \"myApp\"\n ],\n \"lucene\": \"applicationName:myApp\",\n \"serviceFilters\": [\n \"myService\"\n ],\n \"subsystemnameFilters\": [\n \"mySubsystem\"\n ]\n },\n \"createTime\": \"2022-06-30T12:30:00.000Z\",\n \"dataSource\": \"my_namespace/my_dataset\",\n \"description\": \"avg and max the latency of catalog service\",\n \"id\": \"d6a3658e-78d2-47d0-9b81-b2c551f01b09\",\n \"isInternal\": true,\n \"logsQuery\": {\n \"alias\": \"new_query\",\n \"applicationnameFilters\": [\n \"app_name\"\n ],\n \"lucene\": \"log_obj.numeric_field: [50 TO 100]\",\n \"severityFilters\": [],\n \"subsystemnameFilters\": [\n \"sub_name\"\n ]\n },\n \"metricFields\": [\n {\n \"aggregations\": [\n {\n \"none\": {},\n \"enabled\": true,\n \"histogram\": {\n \"buckets\": [\n 2\n ]\n },\n \"samples\": {},\n \"targetMetricName\": \"alias_field_name_agg_func\"\n }\n ],\n \"sourceField\": \"log_obj.numeric_field\",\n \"targetBaseMetricName\": \"alias_field_name\"\n }\n ],\n \"metricLabels\": [\n {\n \"sourceField\": \"log_obj.string_value\",\n \"targetLabel\": \"alias_label_name\"\n }\n ],\n \"updateTime\": \"2022-06-30T12:30:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"e2m": {
"name": "Service_catalog_latency",
"spansQuery": {
"actionFilters": [
"myAction"
],
"applicationnameFilters": [
"myApp"
],
"lucene": "applicationName:myApp",
"serviceFilters": [
"myService"
],
"subsystemnameFilters": [
"mySubsystem"
]
},
"createTime": "2022-06-30T12:30:00.000Z",
"dataSource": "my_namespace/my_dataset",
"description": "avg and max the latency of catalog service",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"isInternal": true,
"logsQuery": {
"alias": "new_query",
"applicationnameFilters": [
"app_name"
],
"lucene": "log_obj.numeric_field: [50 TO 100]",
"severityFilters": [],
"subsystemnameFilters": [
"sub_name"
]
},
"metricFields": [
{
"aggregations": [
{
"none": {},
"enabled": true,
"histogram": {
"buckets": [
2
]
},
"samples": {},
"targetMetricName": "alias_field_name_agg_func"
}
],
"sourceField": "log_obj.numeric_field",
"targetBaseMetricName": "alias_field_name"
}
],
"metricLabels": [
{
"sourceField": "log_obj.string_value",
"targetLabel": "alias_label_name"
}
],
"permutations": {
"hasExceededLimit": true,
"limit": 30000
},
"updateTime": "2022-06-30T12:30:00.000Z"
}
}Replace an E2M
Updates an existing events-to-metrics rule.
curl --request PUT \
--url https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2 \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Service_catalog_latency",
"spansQuery": {
"actionFilters": [
"myAction"
],
"applicationnameFilters": [
"myApp"
],
"lucene": "applicationName:myApp",
"serviceFilters": [
"myService"
],
"subsystemnameFilters": [
"mySubsystem"
]
},
"createTime": "2022-06-30T12:30:00.000Z",
"dataSource": "my_namespace/my_dataset",
"description": "avg and max the latency of catalog service",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"isInternal": true,
"logsQuery": {
"alias": "new_query",
"applicationnameFilters": [
"app_name"
],
"lucene": "log_obj.numeric_field: [50 TO 100]",
"severityFilters": [],
"subsystemnameFilters": [
"sub_name"
]
},
"metricFields": [
{
"aggregations": [
{
"none": {},
"enabled": true,
"histogram": {
"buckets": [
2
]
},
"samples": {},
"targetMetricName": "alias_field_name_agg_func"
}
],
"sourceField": "log_obj.numeric_field",
"targetBaseMetricName": "alias_field_name"
}
],
"metricLabels": [
{
"sourceField": "log_obj.string_value",
"targetLabel": "alias_label_name"
}
],
"updateTime": "2022-06-30T12:30:00.000Z"
}
'import requests
url = "https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2"
payload = {
"name": "Service_catalog_latency",
"spansQuery": {
"actionFilters": ["myAction"],
"applicationnameFilters": ["myApp"],
"lucene": "applicationName:myApp",
"serviceFilters": ["myService"],
"subsystemnameFilters": ["mySubsystem"]
},
"createTime": "2022-06-30T12:30:00.000Z",
"dataSource": "my_namespace/my_dataset",
"description": "avg and max the latency of catalog service",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"isInternal": True,
"logsQuery": {
"alias": "new_query",
"applicationnameFilters": ["app_name"],
"lucene": "log_obj.numeric_field: [50 TO 100]",
"severityFilters": [],
"subsystemnameFilters": ["sub_name"]
},
"metricFields": [
{
"aggregations": [
{
"none": {},
"enabled": True,
"histogram": { "buckets": [2] },
"samples": {},
"targetMetricName": "alias_field_name_agg_func"
}
],
"sourceField": "log_obj.numeric_field",
"targetBaseMetricName": "alias_field_name"
}
],
"metricLabels": [
{
"sourceField": "log_obj.string_value",
"targetLabel": "alias_label_name"
}
],
"updateTime": "2022-06-30T12:30:00.000Z"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Service_catalog_latency',
spansQuery: {
actionFilters: ['myAction'],
applicationnameFilters: ['myApp'],
lucene: 'applicationName:myApp',
serviceFilters: ['myService'],
subsystemnameFilters: ['mySubsystem']
},
createTime: '2022-06-30T12:30:00.000Z',
dataSource: 'my_namespace/my_dataset',
description: 'avg and max the latency of catalog service',
id: 'd6a3658e-78d2-47d0-9b81-b2c551f01b09',
isInternal: true,
logsQuery: {
alias: 'new_query',
applicationnameFilters: ['app_name'],
lucene: 'log_obj.numeric_field: [50 TO 100]',
severityFilters: [],
subsystemnameFilters: ['sub_name']
},
metricFields: [
{
aggregations: [
{
none: {},
enabled: true,
histogram: {buckets: [2]},
samples: {},
targetMetricName: 'alias_field_name_agg_func'
}
],
sourceField: 'log_obj.numeric_field',
targetBaseMetricName: 'alias_field_name'
}
],
metricLabels: [{sourceField: 'log_obj.string_value', targetLabel: 'alias_label_name'}],
updateTime: '2022-06-30T12:30:00.000Z'
})
};
fetch('https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2', 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.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2",
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([
'name' => 'Service_catalog_latency',
'spansQuery' => [
'actionFilters' => [
'myAction'
],
'applicationnameFilters' => [
'myApp'
],
'lucene' => 'applicationName:myApp',
'serviceFilters' => [
'myService'
],
'subsystemnameFilters' => [
'mySubsystem'
]
],
'createTime' => '2022-06-30T12:30:00.000Z',
'dataSource' => 'my_namespace/my_dataset',
'description' => 'avg and max the latency of catalog service',
'id' => 'd6a3658e-78d2-47d0-9b81-b2c551f01b09',
'isInternal' => true,
'logsQuery' => [
'alias' => 'new_query',
'applicationnameFilters' => [
'app_name'
],
'lucene' => 'log_obj.numeric_field: [50 TO 100]',
'severityFilters' => [
],
'subsystemnameFilters' => [
'sub_name'
]
],
'metricFields' => [
[
'aggregations' => [
[
'none' => [
],
'enabled' => true,
'histogram' => [
'buckets' => [
2
]
],
'samples' => [
],
'targetMetricName' => 'alias_field_name_agg_func'
]
],
'sourceField' => 'log_obj.numeric_field',
'targetBaseMetricName' => 'alias_field_name'
]
],
'metricLabels' => [
[
'sourceField' => 'log_obj.string_value',
'targetLabel' => 'alias_label_name'
]
],
'updateTime' => '2022-06-30T12:30:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2"
payload := strings.NewReader("{\n \"name\": \"Service_catalog_latency\",\n \"spansQuery\": {\n \"actionFilters\": [\n \"myAction\"\n ],\n \"applicationnameFilters\": [\n \"myApp\"\n ],\n \"lucene\": \"applicationName:myApp\",\n \"serviceFilters\": [\n \"myService\"\n ],\n \"subsystemnameFilters\": [\n \"mySubsystem\"\n ]\n },\n \"createTime\": \"2022-06-30T12:30:00.000Z\",\n \"dataSource\": \"my_namespace/my_dataset\",\n \"description\": \"avg and max the latency of catalog service\",\n \"id\": \"d6a3658e-78d2-47d0-9b81-b2c551f01b09\",\n \"isInternal\": true,\n \"logsQuery\": {\n \"alias\": \"new_query\",\n \"applicationnameFilters\": [\n \"app_name\"\n ],\n \"lucene\": \"log_obj.numeric_field: [50 TO 100]\",\n \"severityFilters\": [],\n \"subsystemnameFilters\": [\n \"sub_name\"\n ]\n },\n \"metricFields\": [\n {\n \"aggregations\": [\n {\n \"none\": {},\n \"enabled\": true,\n \"histogram\": {\n \"buckets\": [\n 2\n ]\n },\n \"samples\": {},\n \"targetMetricName\": \"alias_field_name_agg_func\"\n }\n ],\n \"sourceField\": \"log_obj.numeric_field\",\n \"targetBaseMetricName\": \"alias_field_name\"\n }\n ],\n \"metricLabels\": [\n {\n \"sourceField\": \"log_obj.string_value\",\n \"targetLabel\": \"alias_label_name\"\n }\n ],\n \"updateTime\": \"2022-06-30T12:30:00.000Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Service_catalog_latency\",\n \"spansQuery\": {\n \"actionFilters\": [\n \"myAction\"\n ],\n \"applicationnameFilters\": [\n \"myApp\"\n ],\n \"lucene\": \"applicationName:myApp\",\n \"serviceFilters\": [\n \"myService\"\n ],\n \"subsystemnameFilters\": [\n \"mySubsystem\"\n ]\n },\n \"createTime\": \"2022-06-30T12:30:00.000Z\",\n \"dataSource\": \"my_namespace/my_dataset\",\n \"description\": \"avg and max the latency of catalog service\",\n \"id\": \"d6a3658e-78d2-47d0-9b81-b2c551f01b09\",\n \"isInternal\": true,\n \"logsQuery\": {\n \"alias\": \"new_query\",\n \"applicationnameFilters\": [\n \"app_name\"\n ],\n \"lucene\": \"log_obj.numeric_field: [50 TO 100]\",\n \"severityFilters\": [],\n \"subsystemnameFilters\": [\n \"sub_name\"\n ]\n },\n \"metricFields\": [\n {\n \"aggregations\": [\n {\n \"none\": {},\n \"enabled\": true,\n \"histogram\": {\n \"buckets\": [\n 2\n ]\n },\n \"samples\": {},\n \"targetMetricName\": \"alias_field_name_agg_func\"\n }\n ],\n \"sourceField\": \"log_obj.numeric_field\",\n \"targetBaseMetricName\": \"alias_field_name\"\n }\n ],\n \"metricLabels\": [\n {\n \"sourceField\": \"log_obj.string_value\",\n \"targetLabel\": \"alias_label_name\"\n }\n ],\n \"updateTime\": \"2022-06-30T12:30:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coralogix.com/mgmt/openapi/5/events2metrics/events2metrics/v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Service_catalog_latency\",\n \"spansQuery\": {\n \"actionFilters\": [\n \"myAction\"\n ],\n \"applicationnameFilters\": [\n \"myApp\"\n ],\n \"lucene\": \"applicationName:myApp\",\n \"serviceFilters\": [\n \"myService\"\n ],\n \"subsystemnameFilters\": [\n \"mySubsystem\"\n ]\n },\n \"createTime\": \"2022-06-30T12:30:00.000Z\",\n \"dataSource\": \"my_namespace/my_dataset\",\n \"description\": \"avg and max the latency of catalog service\",\n \"id\": \"d6a3658e-78d2-47d0-9b81-b2c551f01b09\",\n \"isInternal\": true,\n \"logsQuery\": {\n \"alias\": \"new_query\",\n \"applicationnameFilters\": [\n \"app_name\"\n ],\n \"lucene\": \"log_obj.numeric_field: [50 TO 100]\",\n \"severityFilters\": [],\n \"subsystemnameFilters\": [\n \"sub_name\"\n ]\n },\n \"metricFields\": [\n {\n \"aggregations\": [\n {\n \"none\": {},\n \"enabled\": true,\n \"histogram\": {\n \"buckets\": [\n 2\n ]\n },\n \"samples\": {},\n \"targetMetricName\": \"alias_field_name_agg_func\"\n }\n ],\n \"sourceField\": \"log_obj.numeric_field\",\n \"targetBaseMetricName\": \"alias_field_name\"\n }\n ],\n \"metricLabels\": [\n {\n \"sourceField\": \"log_obj.string_value\",\n \"targetLabel\": \"alias_label_name\"\n }\n ],\n \"updateTime\": \"2022-06-30T12:30:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"e2m": {
"name": "Service_catalog_latency",
"spansQuery": {
"actionFilters": [
"myAction"
],
"applicationnameFilters": [
"myApp"
],
"lucene": "applicationName:myApp",
"serviceFilters": [
"myService"
],
"subsystemnameFilters": [
"mySubsystem"
]
},
"createTime": "2022-06-30T12:30:00.000Z",
"dataSource": "my_namespace/my_dataset",
"description": "avg and max the latency of catalog service",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"isInternal": true,
"logsQuery": {
"alias": "new_query",
"applicationnameFilters": [
"app_name"
],
"lucene": "log_obj.numeric_field: [50 TO 100]",
"severityFilters": [],
"subsystemnameFilters": [
"sub_name"
]
},
"metricFields": [
{
"aggregations": [
{
"none": {},
"enabled": true,
"histogram": {
"buckets": [
2
]
},
"samples": {},
"targetMetricName": "alias_field_name_agg_func"
}
],
"sourceField": "log_obj.numeric_field",
"targetBaseMetricName": "alias_field_name"
}
],
"metricLabels": [
{
"sourceField": "log_obj.string_value",
"targetLabel": "alias_label_name"
}
],
"permutations": {
"hasExceededLimit": true,
"limit": 30000
},
"updateTime": "2022-06-30T12:30:00.000Z"
}
}Authorizations
API key authentication
Body
- E2M
- E2M
- E2M
This data structure represents an Event to Metrics (E2M) object.
Human-readable name for this E2M.
1 - 255^[\s\S]*$"Service_catalog_latency"
This data structure represents a query for spans.
Show child attributes
Show child attributes
E2 m type.
E2M_TYPE_UNSPECIFIED, E2M_TYPE_LOGS2METRICS, E2M_TYPE_SPANS2METRICS RFC3339 timestamp of when this E2M was created.
"2022-06-30T12:30:00.000Z"
Optional data source in namespace/dataset_name format. If not set, defaults to the standard logs/spans stream.
1 - 300^[\s\S]*$"my_namespace/my_dataset"
Human-readable description of this E2M.
2000^[\s\S]*$"avg and max the latency of catalog service"
Unique identifier for this E2M. Required on update requests.
36^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"d6a3658e-78d2-47d0-9b81-b2c551f01b09"
Indicates whether this E2M is for internal use only.
This data structure represents a query for logs.
Show child attributes
Show child attributes
Metric fields to extract and aggregate from the events.
10Show child attributes
Show child attributes
Metric labels to attach to the generated metrics.
10Show child attributes
Show child attributes
This data structure represents the limit of events2metrics permutations and if the limit was exceeded
Show child attributes
Show child attributes
RFC3339 timestamp of when this E2M was last updated.
"2022-06-30T12:30:00.000Z"
Response
This data structure is obtained when replacing an existing event to metric definition
This data structure represents an Event to Metrics (E2M) object.
- E2M
- E2M
- E2M
Show child attributes
Show child attributes
Was this page helpful?