[9.0] [Logs] using All logs dataview in LOGS_LOCATOR (#211549) (#213485)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Logs] using All logs dataview in LOGS_LOCATOR
(#211549)](https://github.com/elastic/kibana/pull/211549)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Yngrid
Coello","email":"yngrid.coello@elastic.co"},"sourceCommit":{"committedDate":"2025-03-06T20:38:00Z","message":"[Logs]
using All logs dataview in LOGS_LOCATOR (#211549)\n\nCloses
https://github.com/elastic/kibana/issues/209122.\n\n### 🎥
Demo\n\n\nhttps://github.com/user-attachments/assets/34d8b544-3ff6-4332-8856-57014fb1fc8a\n\n###
How to test?\n1. Ingest some data using `logs_and_metrics` synthtrace
scenario\n2. Go to `/app/observability/overview` or
`app/metrics/hosts`\n3. Click `logs` link\n4. You should be redirected
to discover and `All logs` should be set
by\ndefault\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"989cf1ec3489784bd5dd13185111115a28c83980","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor","Team:obs-ux-logs","v8.18.0","v9.1.0","v8.19.0"],"title":"[Logs]
using All logs dataview in
LOGS_LOCATOR","number":211549,"url":"https://github.com/elastic/kibana/pull/211549","mergeCommit":{"message":"[Logs]
using All logs dataview in LOGS_LOCATOR (#211549)\n\nCloses
https://github.com/elastic/kibana/issues/209122.\n\n### 🎥
Demo\n\n\nhttps://github.com/user-attachments/assets/34d8b544-3ff6-4332-8856-57014fb1fc8a\n\n###
How to test?\n1. Ingest some data using `logs_and_metrics` synthtrace
scenario\n2. Go to `/app/observability/overview` or
`app/metrics/hosts`\n3. Click `logs` link\n4. You should be redirected
to discover and `All logs` should be set
by\ndefault\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"989cf1ec3489784bd5dd13185111115a28c83980"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211549","number":211549,"mergeCommit":{"message":"[Logs]
using All logs dataview in LOGS_LOCATOR (#211549)\n\nCloses
https://github.com/elastic/kibana/issues/209122.\n\n### 🎥
Demo\n\n\nhttps://github.com/user-attachments/assets/34d8b544-3ff6-4332-8856-57014fb1fc8a\n\n###
How to test?\n1. Ingest some data using `logs_and_metrics` synthtrace
scenario\n2. Go to `/app/observability/overview` or
`app/metrics/hosts`\n3. Click `logs` link\n4. You should be redirected
to discover and `All logs` should be set
by\ndefault\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"989cf1ec3489784bd5dd13185111115a28c83980"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Yngrid Coello <yngrid.coello@elastic.co>
This commit is contained in:
Kibana Machine 2025-03-07 09:23:37 +11:00 committed by GitHub
parent c45a259898
commit 404708c4af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 16 deletions

View file

@ -54,7 +54,7 @@ export const ViewLogsButton: React.FunctionComponent<ViewLogsProps> = ({
from: getTimeRangeStartFromTime(startTime ? startTime : defaultStartTime),
to: getTimeRangeEndFromTime(endTime ? endTime : defaultEndTime),
},
filter: logStreamQuery,
query: { language: 'kuery', query: logStreamQuery },
});
}, [endTime, logStreamQuery, logsLocator, startTime]);

View file

@ -5,11 +5,11 @@
* 2.0.
*/
import type { DiscoverAppLocatorParams } from '@kbn/discover-plugin/common';
import { type DiscoverAppLocatorParams } from '@kbn/discover-plugin/common';
import { ALL_LOGS_DATA_VIEW_ID } from '@kbn/discover-utils/src';
import type { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
import { LocatorDefinition } from '@kbn/share-plugin/common';
import { LocatorClient } from '@kbn/share-plugin/common/url_service';
import type { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
import type { DataViewSpec } from '@kbn/data-views-plugin/common';
/**
* Locator used to link to all log sources in Discover.
@ -17,7 +17,7 @@ import type { DataViewSpec } from '@kbn/data-views-plugin/common';
export const LOGS_LOCATOR_ID = 'LOGS_LOCATOR';
/**
* Accepts the same parameters as `DiscoverAppLocatorParams`, but automatically sets the `dataViewSpec` param to all log sources.
* Accepts the same parameters as `DiscoverAppLocatorParams`, but automatically sets the `dataViewId` param to all log sources.
*/
export type LogsLocatorParams = DiscoverAppLocatorParams;
@ -36,17 +36,8 @@ export class LogsLocatorDefinition implements LocatorDefinition<LogsLocatorParam
this.deps.locators.get<DiscoverAppLocatorParams>('DISCOVER_APP_LOCATOR')!;
return discoverAppLocator.getLocation({
dataViewSpec: params.dataViewSpec ?? (await this.getLogSourcesDataViewSpec()),
dataViewId: ALL_LOGS_DATA_VIEW_ID,
...params,
});
};
private async getLogSourcesDataViewSpec(): Promise<DataViewSpec> {
const logSourcesService = await this.deps.getLogSourcesService();
const logSources = await logSourcesService.getLogSources();
return {
title: logSources.map((logSource) => logSource.indexPattern).join(','),
timeFieldName: '@timestamp',
};
}
}

View file

@ -31,7 +31,7 @@
],
"requiredBundles": [
"kibanaUtils",
"kibanaReact"
"kibanaReact",
],
"extraPublicDirs": [
"common"

View file

@ -58,5 +58,6 @@
"@kbn/analytics",
"@kbn/usage-collection-plugin",
"@kbn/deeplinks-management",
"@kbn/discover-utils",
]
}