Skip to content

Commit 4af10c3

Browse files
Add Exception Type and Message Fields
Fix and run the code and documentation generation for the two new fields exception_type and exception_message. Changes to the Python scripts are required for newer pyyaml versions. Signed-off-by: Karsten Schnitter <[email protected]>
1 parent 772e91a commit 4af10c3

File tree

6 files changed

+50
-2
lines changed

6 files changed

+50
-2
lines changed

cf-java-logging-support-core/beats/app-logs/docs/fields.asciidoc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,28 @@ required: True
448448
The original log message that has been written by the application.
449449

450450

451+
==== exception_type
452+
453+
type: string
454+
455+
example: java.lang.NullPointerException
456+
457+
required: False
458+
459+
The Java class name of the logged exception when available.
460+
461+
462+
==== exception_message
463+
464+
type: string
465+
466+
example: Something went wrong
467+
468+
required: False
469+
470+
The message of the logged exception when available.
471+
472+
451473
==== stacktrace
452474

453475
type: array

cf-java-logging-support-core/beats/app-logs/etc/app-logs.template.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@
6363
"index": "not_analyzed",
6464
"type": "string"
6565
},
66+
"exception_message": {
67+
"doc_values": true,
68+
"index": "not_analyzed",
69+
"type": "string"
70+
},
71+
"exception_type": {
72+
"doc_values": true,
73+
"index": "not_analyzed",
74+
"type": "string"
75+
},
6676
"layer": {
6777
"doc_values": true,
6878
"index": "not_analyzed",

cf-java-logging-support-core/beats/app-logs/etc/fields.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,20 @@ app-logs:
312312
description: |
313313
The original log message that has been written by the application.
314314
315+
- name: "exception_type"
316+
type: string
317+
required: false
318+
example: "java.lang.NullPointerException"
319+
description: |
320+
The Java class name of the logged exception when available.
321+
322+
- name: "exception_message"
323+
type: string
324+
required: false
325+
example: "Something went wrong"
326+
description: |
327+
The message of the logged exception when available.
328+
315329
- name: "stacktrace"
316330
type: array
317331
required: false

cf-java-logging-support-core/beats/scripts/generate_fields_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def fields_to_asciidoc(input, output, beat):
7171
""".format(**dict))
7272

7373

74-
docs = yaml.load(input)
74+
docs = yaml.load(input, Loader=yaml.Loader)
7575

7676
# fields file is empty
7777
if docs is None:

cf-java-logging-support-core/beats/scripts/generate_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def fields_to_es_template(input, output, index):
2222
"""
2323

2424
# Custom properties
25-
docs = yaml.load(input)
25+
docs = yaml.load(input, Loader=yaml.Loader)
2626

2727
# No fields defined, can't generate template
2828
if docs is None:

cf-java-logging-support-core/src/main/java/com/sap/hcp/cf/logging/common/Fields.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public interface Fields {
4444
public String THREAD = "thread";
4545
public String LEVEL = "level";
4646
public String MSG = "msg";
47+
public String EXCEPTION_TYPE = "exception_type";
48+
public String EXCEPTION_MESSAGE = "exception_message";
4749
public String STACKTRACE = "stacktrace";
4850
public String CATEGORIES = "categories";
4951
public String CUSTOM_FIELDS = "#cf";

0 commit comments

Comments
 (0)