From 11b4394707af038fdc87a9ab512545e85b1800d8 Mon Sep 17 00:00:00 2001 From: Josh Dover <1813008+joshdover@users.noreply.github.com> Date: Thu, 10 Mar 2022 18:40:53 +0100 Subject: [PATCH] [Fleet] Fix links to Agent logs for apm, endpoint, synthetics, osquery (#127480) (cherry picked from commit e2ff008f557c12506ffbd2b81b78ff12b6932b16) --- .../components/agent_details/input_type_utils.ts | 16 ++++++++++++++++ .../components/agent_logs/constants.tsx | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/input_type_utils.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/input_type_utils.ts index dd1197a8ee2d7..3f3660582d493 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/input_type_utils.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/input_type_utils.ts @@ -11,6 +11,10 @@ import { STATE_DATASET_FIELD, AGENT_DATASET_FILEBEAT, AGENT_DATASET_METRICBEAT, + AGENT_DATASET_APM_SERVER, + AGENT_DATASET_ENDPOINT_SECURITY, + AGENT_DATASET_OSQUERYBEAT, + AGENT_DATASET_HEARTBEAT, } from '../agent_logs/constants'; export function displayInputType(inputType: string): string { @@ -40,6 +44,18 @@ export function getLogsQueryByInputType(inputType: string) { if (inputType.match(/\/metrics$/)) { return `(${STATE_DATASET_FIELD}:!(${AGENT_DATASET_METRICBEAT}))`; } + if (inputType === 'osquery') { + return `(${STATE_DATASET_FIELD}:!(${AGENT_DATASET_OSQUERYBEAT}))`; + } + if (inputType.match(/^synthetics\//)) { + return `(${STATE_DATASET_FIELD}:!(${AGENT_DATASET_HEARTBEAT}))`; + } + if (inputType === 'apm') { + return `(${STATE_DATASET_FIELD}:!(${AGENT_DATASET_APM_SERVER}))`; + } + if (inputType === 'endpoint') { + return `(${STATE_DATASET_FIELD}:!(${AGENT_DATASET_ENDPOINT_SECURITY}))`; + } return ''; } diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx index f4c6e19f09322..18af09c48f220 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/constants.tsx @@ -11,6 +11,10 @@ export const AGENT_LOG_INDEX_PATTERN = 'logs-elastic_agent-*,logs-elastic_agent. export const AGENT_DATASET = 'elastic_agent'; export const AGENT_DATASET_FILEBEAT = 'elastic_agent.filebeat'; export const AGENT_DATASET_METRICBEAT = 'elastic_agent.metricbeat'; +export const AGENT_DATASET_OSQUERYBEAT = 'elastic_agent.osquerybeat'; +export const AGENT_DATASET_HEARTBEAT = 'elastic_agent.heartbeat'; +export const AGENT_DATASET_APM_SERVER = 'elastic_agent.apm_server'; +export const AGENT_DATASET_ENDPOINT_SECURITY = 'elastic_agent.endpoint_security'; export const AGENT_DATASET_PATTERN = 'elastic_agent.*'; export const AGENT_ID_FIELD = { name: 'elastic_agent.id',