diff --git a/packages/kbn-apm-types/src/es_fields/apm.ts b/packages/kbn-apm-types/src/es_fields/apm.ts index 617f96996323f..6b0a68379f5d4 100644 --- a/packages/kbn-apm-types/src/es_fields/apm.ts +++ b/packages/kbn-apm-types/src/es_fields/apm.ts @@ -196,3 +196,5 @@ export const CLIENT_GEO_CITY_NAME = 'client.geo.city_name'; export const CLIENT_GEO_REGION_NAME = 'client.geo.region_name'; export const CHILD_ID = 'child.id'; + +export const LOG_LEVEL = 'log.level'; diff --git a/x-pack/plugins/observability_solution/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap b/x-pack/plugins/observability_solution/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap index 3c101b4357528..6fa3e146a423d 100644 --- a/x-pack/plugins/observability_solution/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap +++ b/x-pack/plugins/observability_solution/apm/common/es_fields/__snapshots__/es_fields.test.ts.snap @@ -168,6 +168,8 @@ exports[`Error LABEL_TELEMETRY_AUTO_VERSION 1`] = `undefined`; exports[`Error LABEL_TYPE 1`] = `undefined`; +exports[`Error LOG_LEVEL 1`] = `undefined`; + exports[`Error METRIC_CGROUP_MEMORY_LIMIT_BYTES 1`] = `undefined`; exports[`Error METRIC_CGROUP_MEMORY_USAGE_BYTES 1`] = `undefined`; @@ -501,6 +503,8 @@ exports[`Span LABEL_TELEMETRY_AUTO_VERSION 1`] = `undefined`; exports[`Span LABEL_TYPE 1`] = `undefined`; +exports[`Span LOG_LEVEL 1`] = `undefined`; + exports[`Span METRIC_CGROUP_MEMORY_LIMIT_BYTES 1`] = `undefined`; exports[`Span METRIC_CGROUP_MEMORY_USAGE_BYTES 1`] = `undefined`; @@ -844,6 +848,8 @@ exports[`Transaction LABEL_TELEMETRY_AUTO_VERSION 1`] = `undefined`; exports[`Transaction LABEL_TYPE 1`] = `undefined`; +exports[`Transaction LOG_LEVEL 1`] = `undefined`; + exports[`Transaction METRIC_CGROUP_MEMORY_LIMIT_BYTES 1`] = `undefined`; exports[`Transaction METRIC_CGROUP_MEMORY_USAGE_BYTES 1`] = `undefined`; diff --git a/x-pack/plugins/observability_solution/apm/public/components/app/entities/charts/log_error_rate_chart.tsx b/x-pack/plugins/observability_solution/apm/public/components/app/entities/charts/log_error_rate_chart.tsx index 15e253226d035..3b59dab86baf7 100644 --- a/x-pack/plugins/observability_solution/apm/public/components/app/entities/charts/log_error_rate_chart.tsx +++ b/x-pack/plugins/observability_solution/apm/public/components/app/entities/charts/log_error_rate_chart.tsx @@ -9,6 +9,7 @@ import { i18n } from '@kbn/i18n'; import { EuiPanel, EuiTitle, EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { css } from '@emotion/react'; +import { SERVICE_NAME } from '@kbn/observability-shared-plugin/common'; import { useApmParams } from '../../../../hooks/use_apm_params'; import { useFetcher } from '../../../../hooks/use_fetcher'; import { useTimeRange } from '../../../../hooks/use_time_range'; @@ -23,6 +24,8 @@ import { getMetricsFormula, } from '../../../shared/charts/helper/get_metrics_formulas'; import { ExploreLogsButton } from '../../../shared/explore_logs_button/explore_logs_button'; +import { mergeKueries, toKueryFilterFormat } from '../../../../../common/utils/kuery_utils'; +import { ERROR_LOG_LEVEL, LOG_LEVEL } from '../../../../../common/es_fields/apm'; type LogErrorRateReturnType = APIReturnType<'GET /internal/apm/entities/services/{serviceName}/logs_error_rate_timeseries'>; @@ -74,6 +77,14 @@ export function LogErrorRateChart({ height }: { height: number }) { }, ]; + const errorLogKueryFormat = mergeKueries( + [ + toKueryFilterFormat(LOG_LEVEL, ['error', 'ERROR']), + toKueryFilterFormat(ERROR_LOG_LEVEL, ['error', 'ERROR']), + ], + 'OR' + ); + return ( @@ -123,7 +134,10 @@ export function LogErrorRateChart({ height }: { height: number }) { diff --git a/x-pack/plugins/observability_solution/entity_manager/server/lib/entities/built_in/services.ts b/x-pack/plugins/observability_solution/entity_manager/server/lib/entities/built_in/services.ts index 78f6b9f4e6041..e52abf4142fb4 100644 --- a/x-pack/plugins/observability_solution/entity_manager/server/lib/entities/built_in/services.ts +++ b/x-pack/plugins/observability_solution/entity_manager/server/lib/entities/built_in/services.ts @@ -20,7 +20,7 @@ const serviceTransactionFilter = (additionalFilters: string[] = []) => { export const builtInServicesFromLogsEntityDefinition: EntityDefinition = entityDefinitionSchema.parse({ - version: '1.0.1', + version: '1.0.2', id: `${BUILT_IN_ID_PREFIX}services_from_ecs_data`, name: 'Services from ECS data', description: @@ -109,7 +109,8 @@ export const builtInServicesFromLogsEntityDefinition: EntityDefinition = { name: 'A', aggregation: 'doc_count', - filter: 'log.level: "error" OR log.level: "ERROR" OR error.log.level: "error"', + filter: + 'log.level: "error" OR log.level: "ERROR" OR error.log.level: "error" OR error.log.level: "ERROR"', }, ], },