Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra UI] Improve built-in log reconstruction rules for development and demos #22213

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const createLogEntryStreamItem = (logEntry: LogEntry, searchResult?: SearchResul
fields: {
time: logEntry.key.time,
tiebreaker: logEntry.key.tiebreaker,
message: logEntry.message.map(formatMessageSegment).join(' '),
message: logEntry.message.map(formatMessageSegment).join(''),
},
},
searchResult,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const filebeatApache2Rules = [
{
when: {
exists: ['apache2.access'],
},
format: [
{
constant: 'apache2',
},
{
constant: ' ',
},
{
field: 'apache2.access.remote_ip',
},
{
constant: ' ',
},
{
field: 'apache2.access.user_name',
},
{
constant: ' "',
},
{
field: 'apache2.access.method',
},
{
constant: ' ',
},
{
field: 'apache2.access.url',
},
{
constant: ' HTTP/',
},
{
field: 'apache2.access.http_version',
},
{
constant: '" ',
},
{
field: 'apache2.access.response_code',
},
{
constant: ' ',
},
{
field: 'apache2.access.body_sent.bytes',
},
],
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const filebeatNginxRules = [
{
when: {
exists: ['nginx.access'],
},
format: [
{
constant: 'nginx',
},
{
constant: ' ',
},
{
field: 'nginx.access.remote_ip',
},
{
constant: ' ',
},
{
field: 'nginx.access.user_name',
},
{
constant: ' "',
},
{
field: 'nginx.access.method',
},
{
constant: ' ',
},
{
field: 'nginx.access.url',
},
{
constant: ' HTTP/',
},
{
field: 'nginx.access.http_version',
},
{
constant: '" ',
},
{
field: 'nginx.access.response_code',
},
{
constant: ' ',
},
{
field: 'nginx.access.body_sent.bytes',
},
],
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const filebeatRedisRules = [
{
when: {
exists: ['redis.log.message'],
},
format: [
{
constant: 'redis',
},
{
constant: ' ',
},
{
field: 'redis.log.message',
},
],
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const filebeatSystemRules = [
{
when: {
exists: ['system.syslog.message'],
},
format: [
{
field: 'system.syslog.message',
},
],
},
{
when: {
exists: ['system.auth.message'],
},
format: [
{
field: 'system.auth.message',
},
],
},
{
when: {
exists: ['system.auth.ssh.event'],
},
format: [
{
constant: 'ssh',
},
{
constant: ' ',
},
{
field: 'system.auth.ssh.event',
},
{
constant: ' user ',
},
{
field: 'system.auth.user',
},
{
constant: ' from ',
},
{
field: 'system.auth.ssh.ip',
},
],
},
{
when: {
exists: ['system.auth.ssh.dropped_ip'],
},
format: [
{
constant: 'ssh',
},
{
constant: ' Dropped connection from ',
},
{
field: 'system.auth.ssh.dropped_ip',
},
],
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const genericRules = [
{
when: {
exists: ['message'],
},
format: [
{
field: 'message',
},
],
},
{
when: {
exists: ['@message'],
},
format: [
{
field: '@message',
},
],
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,28 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { filebeatApache2Rules } from './filebeat_apache2';
import { filebeatNginxRules } from './filebeat_nginx';
import { filebeatRedisRules } from './filebeat_redis';
import { filebeatSystemRules } from './filebeat_system';
import { genericRules } from './generic';

export const builtinRules = [
...filebeatApache2Rules,
...filebeatNginxRules,
...filebeatRedisRules,
...filebeatSystemRules,
...genericRules,
{
when: {
exists: ['system.syslog.message'],
},
format: [
{
field: 'system.syslog.message',
},
],
},
{
when: {
exists: ['system.auth.message'],
exists: ['source'],
},
format: [
{
field: 'system.auth.message',
constant: 'failed to format message from ',
},
],
},
{
when: {
exists: ['message'],
},
format: [
{
field: 'message',
},
],
},
{
when: {
exists: ['@message'],
},
format: [
{
field: '@message',
field: 'source',
},
],
},
Expand Down