Skip to content

Commit

Permalink
Add error.stack_trace to the default log formatter (#94906) (#95544)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Barnsteiner <[email protected]>
  • Loading branch information
kibanamachine and felixbarny authored Mar 26, 2021
1 parent 01f17e9 commit 30abcf5
Showing 1 changed file with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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],
Expand All @@ -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],
Expand Down

0 comments on commit 30abcf5

Please sign in to comment.