Add error.stack_trace to the default log formatter (#94906)

This commit is contained in:
Felix Barnsteiner 2021-03-26 17:09:34 +01:00 committed by GitHub
parent 924724cf0b
commit 9ebb38974c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,6 +45,37 @@ export const getGenericRules = (genericMessageFields: string[]) => [
];
const createGenericRulesForField = (fieldName: string) => [
{
when: {
exists: ['event.dataset', 'log.level', fieldName, 'error.stack_trace.text'],
},
format: [
{
constant: '[',
},
{
field: 'event.dataset',
},
{
constant: '][',
},
{
field: 'log.level',
},
{
constant: '] ',
},
{
field: fieldName,
},
{
constant: '\n',
},
{
field: 'error.stack_trace.text',
},
],
},
{
when: {
exists: ['event.dataset', 'log.level', fieldName],
@ -70,6 +101,31 @@ const createGenericRulesForField = (fieldName: string) => [
},
],
},
{
when: {
exists: ['log.level', fieldName, 'error.stack_trace.text'],
},
format: [
{
constant: '[',
},
{
field: 'log.level',
},
{
constant: '] ',
},
{
field: fieldName,
},
{
constant: '\n',
},
{
field: 'error.stack_trace.text',
},
],
},
{
when: {
exists: ['log.level', fieldName],
@ -89,6 +145,22 @@ const createGenericRulesForField = (fieldName: string) => [
},
],
},
{
when: {
exists: [fieldName, 'error.stack_trace.text'],
},
format: [
{
field: fieldName,
},
{
constant: '\n',
},
{
field: 'error.stack_trace.text',
},
],
},
{
when: {
exists: [fieldName],