diff --git a/public/app/core/logs_model.ts b/public/app/core/logs_model.ts index bb06277de65..ba0b3438a2f 100644 --- a/public/app/core/logs_model.ts +++ b/public/app/core/logs_model.ts @@ -319,10 +319,7 @@ export function logSeriesToLogsModel(logSeries: DataFrame[]): LogsModel | undefi // Find the fields we care about and collect all labels const allSeries: LogFields[] = logSeries.map(series => { const fieldCache = new FieldCache(series); - - const stringField = fieldCache.hasFieldNamed('line') - ? fieldCache.getFieldByName('line') - : fieldCache.getFirstFieldOfType(FieldType.string); + const stringField = fieldCache.getFirstFieldOfType(FieldType.string); if (stringField?.labels) { allLabels.push(stringField.labels); } diff --git a/public/app/plugins/datasource/loki/result_transformer.ts b/public/app/plugins/datasource/loki/result_transformer.ts index 8c2ba7409da..c8ea38fd9ec 100644 --- a/public/app/plugins/datasource/loki/result_transformer.ts +++ b/public/app/plugins/datasource/loki/result_transformer.ts @@ -78,7 +78,7 @@ function constructDataFrame( refId, fields: [ { name: 'ts', type: FieldType.time, config: { displayName: 'Time' }, values: times }, // Time - { name: 'line', type: FieldType.string, config: {}, values: lines, labels }, // Line + { name: 'line', type: FieldType.string, config: {}, values: lines, labels }, // Line - needs to be the first field with string type { name: 'id', type: FieldType.string, config: {}, values: uids }, { name: 'tsNs', type: FieldType.time, config: { displayName: 'Time ns' }, values: timesNs }, // Time ],