New Relic is an observability platform that is based on cloud computing and is designed to help you develop applications. You can use New Relic to integrate data, analyze data, and handle events at the earliest opportunity. You need only to configure a notification channel in the New Relic console and configure the webhook URL that is provided by the alert ingestion system of Log Service for the channel. This way, New Relic can send alerts to the alerting system of Log Service. Then, the alerting system processes the alerts, such as denoising the alerts and sending alert notifications.
Configure New Relic
- Log on to the New Relic console.
- Configure a notification channel.
- Apply an alert rule to the notification channel.
- In the top navigation bar, choose .
- In the list of alert rules, find and click the alert rule that you want to use.
- On the Notification channel tab, click Add notification channels.
- Select the notification channel that you create.
New Relic alerts
The following sample code provides an example of a New Relic alert:
{
"alert_instance_id": 123456,
"alert_name": "wkbTest",
"alert_time": 1629445629043,
"fire_time": 1629445629043,
"fire_results":
[
{
"id": "Metric",
"name": "cn-hangzhou_ecs.s6-c1m4.xlarge_123456789",
"link": "https://insights.newrelic.com/accounts/123456/query?query=SELECT%20average%28%60host.diskUsedPercent%60%29%20FROM%20Metric%20FACET%20regionId%2C%20host.instanceType%2C%20%20entity.id%20TIMESERIES%201%20minute%20SINCE%20%272021-08-20%2001%3A48%3A08%27%20UNTIL%20%272021-08-20%2007%3A47%3A08%27",
"labels":
{
"entity.id": "123456789",
"host.instanceType": "ecs.s6-c1m4.xlarge",
"regionId": "cn-hangzhou"
},
"product": "NRQL",
"type": "Query"
}
],
"resolve_time": 1629445629043,
"status": "open",
"labels":
{
"metadata":
{
"evaluation_system_source": "Willamette"
}
},
"annotations":
{
"owner": "",
"open_violations_count_critical": 1,
"closed_violations_count_critical": 0,
"__link_policy_url__": "https://alerts.newrelic.com/accounts/123456/policies/123456",
"__link_violation_chart_url__": "https://gorgon.nr-assets.net/image/1a2b3c4d-1234-abcd-1a2b-1a2b3c4d?config.legend.enabled=false",
"condition_id": 123456,
"duration": 476,
"open_violations_count_warning": 0,
"__account_name__": "Account 123456",
"event_type": "INCIDENT",
"__link_runbook_url__": null,
"__link_violation_callback_url__": "https://insights.newrelic.com/accounts/123456/query?query=SELECT%20average%28%60host.diskUsedPercent%60%29%20FROM%20Metric%20FACET%20regionId%2C%20host.instanceType%2C%20%20entity.id%20TIMESERIES%201%20minute%20SINCE%20%272021-08-20%2001%3A48%3A08%27%20UNTIL%20%272021-08-20%2007%3A47%3A08%27",
"timestamp_utc_string": "2021-08-20, 07:47 UTC",
"__account_id__": 123456,
"condition_description": "this is cond0",
"__link_incident_acknowledge_url__": "https://alerts.newrelic.com/accounts/123456/incidents/123456/acknowledge",
"closed_violations_count_warning": 0,
"condition_name": "cond0",
"desc": "Metric query result is > 0.0 on 'cond0'"
},
"severity": "CRITICAL",
"drill_down_query": "https://alerts.newrelic.com/accounts/123456/incidents/123456",
}
Field mappings
After a New Relic alert is ingested into Log Service, the alert is converted to a Log Service alert based on field mappings. The following sample code provides an example of a Log Service alert:
{
"aliuid": "aliuid1",
"alert_instance_id": "123456",
"alert_id": "NewRelic_wkbTest",
"alert_type": "sls_pub",
"alert_name": "test-alert",
"region": "{The region of the project to which Alert Center belongs}",
"project": "{The project to which Alert Center belongs}",
"project_id": 0,
"next_eval_interval": 0,
"alert_time": 1629445629,
"fire_time": 1629445629,
"fire_results":
[
{
"id": "Metric",
"link": "https://insights.newrelic.com/accounts/123456/query?query=SELECT%20average%28%60host.diskUsedPercent%60%29%20FROM%20Metric%20FACET%20regionId%2C%20host.instanceType%2C%20%20entity.id%20TIMESERIES%201%20minute%20SINCE%20%272021-08-20%2001%3A48%3A08%27%20UNTIL%20%272021-08-20%2007%3A47%3A08%27",
"name": "cn-hangzhou_ecs.s6-c1m4.xlarge_123456789",
"product": "NRQL",
"type": "Query"
}
],
"fire_results_count": 1,
"resolve_time": 0,
"status": "firing",
"results": null,
"labels":
{
"evaluation_system_source": "Willamette"
},
"annotations":
{
"__account_id__": "123456",
"__account_name__": "Account 123456",
"__config_app__": "sls_pub_alert",
"__link_incident_acknowledge_url__": "https://alerts.newrelic.com/accounts/123456/incidents/123456/acknowledge",
"__link_policy_url__": "https://alerts.newrelic.com/accounts/123456/policies/123456",
"__link_violation_callback_url__": "https://insights.newrelic.com/accounts/123456/query?query=SELECT%20average%28%60host.diskUsedPercent%60%29%20FROM%20Metric%20FACET%20regionId%2C%20host.instanceType%2C%20%20entity.id%20TIMESERIES%201%20minute%20SINCE%20%272021-08-20%2001%3A48%3A08%27%20UNTIL%20%272021-08-20%2007%3A47%3A08%27",
"__link_violation_chart_url__": "https://gorgon.nr-assets.net/image/1a2b3c4d-1234-abcd-1a2b-1a2b3c4d?config.legend.enabled=false",
"__pub_alert_app__": "{The ID of the alert ingestion application}",
"__pub_alert_protocol__": "newrelic",
"__pub_alert_region__": "{The region of the endpoint to which the alert is sent}",
"__pub_alert_service__": "{The ID of the alert ingestion service}",
"condition_description": "this is cond0",
"condition_id": "123456",
"condition_name": "cond0",
"desc": "Metric query result is > 0.0 on 'cond0'",
"duration": "476",
"event_type": "INCIDENT",
"open_violations_count_critical": "1",
"timestamp_utc_string": "2021-08-20, 07:47 UTC"
},
"severity": 10,
"policy":
{
"alert_policy_id": "{The ID of the alert policy that is specified for the alert ingestion application}",
"action_policy_id": "{The ID of the action policy that is specified for the alert ingestion application}",
"use_default": false,
"repeat_interval": "{The cycle that is specified for the alert ingestion application}"
},
"template": null,
"drill_down_query": "https://alerts.newrelic.com/accounts/123456/incidents/123456"
}
Log Service | New Relic | Description |
---|---|---|
aliuid | None | The ID of the Alibaba Cloud account to which the alert ingestion application belongs. |
alert_id | None | The ID of the alert monitoring rule.
The value of the alert_id field is in the NewRelic_${alert_name} format. ${alert_name} indicates the name of the alert monitoring rule. |
alert_instance_id | alert_instance_id | The ID of the alert. |
alert_type | None | The type of the alert. The value is fixed as sls_pub. |
alert_name | alert_name | The name of the alert monitoring rule. |
status | status | The status of the alert.
|
next_eval_interval | None | The interval for alert evaluation. The value is fixed as 0. |
alert_time | alert_time | The time at which the alert is triggered. |
fire_results | fire_results | The query parameters and intermediate results of the alert. The value of this field
is of the array type.
In the value of the fire_results field in the New Relic alert, if the value of an element is not a string, the key-value pair that corresponds to this element is deleted. Other key-value pairs are added to the fire_results field in the Log Service alert. |
fire_results_count | None | The number of elements in the value of the fire_results field. |
fire_time | fire_time | The time at which the alert is first triggered. |
resolve_time | resolve_time | The time at which the alert is cleared.
|
labels | labels | The labels of the alert.
|
annotations | annotations | The annotations of the alert. After the New Relic alert is ingested into Log Service,
the following fields are added to the annotations field in the Log Service alert:
|
severity | severity | The severity of the alert. The following list describes the severity mappings between
New Relic and Log Service alerts:
Note If no severity is specified in the New Relic alert, the severity of the Log Service
alert is Medium.
|
policy | None | The alert policy that is specified for the alert ingestion application. For more information, see Description of the policy variable. |
project | None | The project to which Alert Center belongs. For more information, see Project. |
drill_down_query | drill_down_query | The URL of the page on which you can manage the New Relic alert. |