POST
/
api
/
v2
/
events2metrics
const fetch = require('node-fetch');

let url = 'https://api.coralogix.com/mgmt/openapi/api/v2/events2metrics';

let options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
  body: '{"name":"Service catalog latency","description":"avg and max the latency of catalog service","permutationsLimit":30000,"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"]}}'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
{
  "e2m": {
    "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
  }
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json

This data structure is used to create a new event to metric definition

Response

200
application/json

A successful response.

The response is of type object.