Skip to content

Commit

Permalink
[Fleet] Fix links to Agent logs for apm, endpoint, synthetics, osquery (
Browse files Browse the repository at this point in the history
#127480) (#127495)

(cherry picked from commit e2ff008)

Co-authored-by: Josh Dover <[email protected]>
  • Loading branch information
kibanamachine and joshdover authored Mar 10, 2022
1 parent 1b8bb14 commit e1b2149
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 '';
}
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit e1b2149

Please sign in to comment.