const fetch = require('node-fetch');
let url = 'https://api.coralogix.com/mgmt/openapi/api/v2/events2metrics';
let options = {
method: 'PUT',
headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
body: '{"id":"d6a3658e-78d2-47d0-9b81-b2c551f01b09","name":"Service_catalog_latency","description":"avg and max the latency of catalog service","createTime":"2022-06-30T12:30:00Z\'","updateTime":"2022-06-30T12:30:00Z\'","permutations":{"limit":30000,"hasExceededLimit":true},"metricLabels":[{"targetLabel":"alias_label_name","sourceField":"log_obj.string_value"}],"metricFields":[{"targetBaseMetricName":"alias_field_name","sourceField":"log_obj.numeric_field","aggregations":[{"enabled":true,"aggType":"AGG_TYPE_UNSPECIFIED","targetMetricName":"alias_field_name_agg_func","samples":{"sampleType":"SAMPLE_TYPE_UNSPECIFIED"},"histogram":{"buckets":2}}]}],"type":"E2M_TYPE_UNSPECIFIED","spansQuery":{"lucene":"applicationName:myApp","applicationnameFilters":"myApp","subsystemnameFilters":"mySubsystem","actionFilters":"myAction","serviceFilters":"myService"},"logsQuery":{"lucene":"log_obj.numeric_field: [50 TO 100]","alias":"new_query","applicationnameFilters":"app_name","subsystemnameFilters":"sub_name","severityFilters":["SEVERITY_UNSPECIFIED"]},"isInternal":true}'
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));{
"e2m": {
"name": "Service_catalog_latency",
"type": "E2M_TYPE_UNSPECIFIED",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"description": "avg and max the latency of catalog service",
"createTime": "2022-06-30T12:30:00Z'",
"updateTime": "2022-06-30T12:30:00Z'",
"permutations": {
"limit": 30000,
"hasExceededLimit": true
},
"metricLabels": [
{
"targetLabel": "alias_label_name",
"sourceField": "log_obj.string_value"
}
],
"metricFields": [
{
"targetBaseMetricName": "alias_field_name",
"sourceField": "log_obj.numeric_field",
"aggregations": [
{
"enabled": true,
"aggType": "AGG_TYPE_UNSPECIFIED",
"targetMetricName": "alias_field_name_agg_func",
"samples": {
"sampleType": "SAMPLE_TYPE_UNSPECIFIED"
},
"histogram": {
"buckets": 2
}
}
]
}
],
"spansQuery": {
"lucene": "applicationName:myApp",
"applicationnameFilters": "myApp",
"subsystemnameFilters": "mySubsystem",
"actionFilters": "myAction",
"serviceFilters": "myService"
},
"logsQuery": {
"lucene": "log_obj.numeric_field: [50 TO 100]",
"alias": "new_query",
"applicationnameFilters": "app_name",
"subsystemnameFilters": "sub_name",
"severityFilters": [
"SEVERITY_UNSPECIFIED"
]
},
"isInternal": true
}
}No description available
const fetch = require('node-fetch');
let url = 'https://api.coralogix.com/mgmt/openapi/api/v2/events2metrics';
let options = {
method: 'PUT',
headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
body: '{"id":"d6a3658e-78d2-47d0-9b81-b2c551f01b09","name":"Service_catalog_latency","description":"avg and max the latency of catalog service","createTime":"2022-06-30T12:30:00Z\'","updateTime":"2022-06-30T12:30:00Z\'","permutations":{"limit":30000,"hasExceededLimit":true},"metricLabels":[{"targetLabel":"alias_label_name","sourceField":"log_obj.string_value"}],"metricFields":[{"targetBaseMetricName":"alias_field_name","sourceField":"log_obj.numeric_field","aggregations":[{"enabled":true,"aggType":"AGG_TYPE_UNSPECIFIED","targetMetricName":"alias_field_name_agg_func","samples":{"sampleType":"SAMPLE_TYPE_UNSPECIFIED"},"histogram":{"buckets":2}}]}],"type":"E2M_TYPE_UNSPECIFIED","spansQuery":{"lucene":"applicationName:myApp","applicationnameFilters":"myApp","subsystemnameFilters":"mySubsystem","actionFilters":"myAction","serviceFilters":"myService"},"logsQuery":{"lucene":"log_obj.numeric_field: [50 TO 100]","alias":"new_query","applicationnameFilters":"app_name","subsystemnameFilters":"sub_name","severityFilters":["SEVERITY_UNSPECIFIED"]},"isInternal":true}'
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));{
"e2m": {
"name": "Service_catalog_latency",
"type": "E2M_TYPE_UNSPECIFIED",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"description": "avg and max the latency of catalog service",
"createTime": "2022-06-30T12:30:00Z'",
"updateTime": "2022-06-30T12:30:00Z'",
"permutations": {
"limit": 30000,
"hasExceededLimit": true
},
"metricLabels": [
{
"targetLabel": "alias_label_name",
"sourceField": "log_obj.string_value"
}
],
"metricFields": [
{
"targetBaseMetricName": "alias_field_name",
"sourceField": "log_obj.numeric_field",
"aggregations": [
{
"enabled": true,
"aggType": "AGG_TYPE_UNSPECIFIED",
"targetMetricName": "alias_field_name_agg_func",
"samples": {
"sampleType": "SAMPLE_TYPE_UNSPECIFIED"
},
"histogram": {
"buckets": 2
}
}
]
}
],
"spansQuery": {
"lucene": "applicationName:myApp",
"applicationnameFilters": "myApp",
"subsystemnameFilters": "mySubsystem",
"actionFilters": "myAction",
"serviceFilters": "myService"
},
"logsQuery": {
"lucene": "log_obj.numeric_field: [50 TO 100]",
"alias": "new_query",
"applicationnameFilters": "app_name",
"subsystemnameFilters": "sub_name",
"severityFilters": [
"SEVERITY_UNSPECIFIED"
]
},
"isInternal": true
}
}API key authentication
This data structure represents an Event to Metrics (E2M) object.
"Service_catalog_latency"
E2M_TYPE_UNSPECIFIED, E2M_TYPE_LOGS2METRICS, E2M_TYPE_SPANS2METRICS 36^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"d6a3658e-78d2-47d0-9b81-b2c551f01b09"
"avg and max the latency of catalog service"
"2022-06-30T12:30:00Z'"
"2022-06-30T12:30:00Z'"
This data structure represents the limit of events2metrics permutations and if the limit was exceeded
Show child attributes
Show child attributes
10Show child attributes
This data structure represents a query for spans.
Show child attributes
This data structure represents a query for logs.
Show child attributes
A successful response.
This data structure is obtained when replacing an existing event to metric definition
This data structure represents an Event to Metrics (E2M) object.
Show child attributes
Was this page helpful?