diff --git a/public/app/features/logs/legacyLogsFrame.ts b/public/app/features/logs/legacyLogsFrame.ts index e6b3bbc4399..902c973a093 100644 --- a/public/app/features/logs/legacyLogsFrame.ts +++ b/public/app/features/logs/legacyLogsFrame.ts @@ -45,7 +45,7 @@ export function parseLegacyLogsFrame(frame: DataFrame): LogsFrame | null { } const timeNanosecondField = cache.getFieldByName('tsNs') ?? null; - const severityField = cache.getFieldByName('detected_level') ?? cache.getFieldByName('level') ?? null; + const severityField = cache.getFieldByName('level') ?? cache.getFieldByName('detected_level') ?? null; const idField = cache.getFieldByName('id') ?? null; // extracting the labels is done very differently for old-loki-style and simple-style diff --git a/public/app/features/logs/logsModel.ts b/public/app/features/logs/logsModel.ts index 9be17b8dec1..a298b7f0bb9 100644 --- a/public/app/features/logs/logsModel.ts +++ b/public/app/features/logs/logsModel.ts @@ -426,7 +426,7 @@ export function logSeriesToLogsModel( } let logLevel = LogLevel.unknown; - const logLevelKey = (logLevelField && logLevelField.values[j]) || (labels?.detected_level ?? labels?.level); + const logLevelKey = (logLevelField && logLevelField.values[j]) || (labels?.level ?? labels?.detected_level); if (typeof logLevelKey === 'number' || typeof logLevelKey === 'string') { logLevel = getLogLevelFromKey(logLevelKey); } else { @@ -643,7 +643,7 @@ function defaultExtractLevel(dataFrame: DataFrame): LogLevel { } function getLogLevelFromLabels(labels: Labels): LogLevel { - const level = labels['detected_level'] ?? labels['level'] ?? labels['lvl'] ?? labels['loglevel'] ?? ''; + const level = labels['level'] ?? labels['detected_level'] ?? labels['lvl'] ?? labels['loglevel'] ?? ''; return level ? getLogLevelFromKey(level) : LogLevel.unknown; } diff --git a/public/app/plugins/datasource/loki/responseUtils.ts b/public/app/plugins/datasource/loki/responseUtils.ts index dcfafdc670a..95c9112b91c 100644 --- a/public/app/plugins/datasource/loki/responseUtils.ts +++ b/public/app/plugins/datasource/loki/responseUtils.ts @@ -122,7 +122,7 @@ export function extractLevelLikeLabelFromDataFrame(frame: DataFrame): string | n // Find first level-like label for (let labels of labelsArray) { const label = Object.keys(labels).find( - (label) => label === 'detected_level' || label === 'level' || label === 'lvl' || label.includes('level') + (label) => label === 'level' || label === 'detected_level' || label === 'lvl' || label.includes('level') ); if (label) { levelLikeLabel = label;