Thorntail (WildFly Swarm 2.x)
Following settings can be used:
Attribute Name | Description | Default |
---|---|---|
enabled | Whether this handler is enabled | true |
host | Hostname/IP-Address of the Logstash host. The host field accepts following forms:
|
none |
port | Port of the Logstash host | 12201 |
version | GELF Version 1.0 or 1.1 |
1.0 |
originHost | Originating Hostname | FQDN Hostname |
extractStackTrace | Send the Stack-Trace to the StackTrace field (true /false ) |
false |
filterStackTrace | Perform Stack-Trace filtering (true /false ) |
false |
includeLogMessageParameters | Include message parameters from the log event | true |
includeLocation | Include source code location | true |
facility | Name of the Facility | logstash-gelf |
mdcProfiling | Perform Profiling (Call-Duration) based on MDC Data. See MDC Profiling for details | false |
level | Log-Level threshold | INFO |
filter | Class-Name of a Log-Filter | none |
additionalFields | Send additional static fields. The fields are specified as key-value pairs are comma-separated. Example: additionalFields: fieldName: Value,fieldName2: Value2 |
none |
additionalFieldTypes | Type specification for additional and MDC fields. Supported types: String , long , Long , double , Double and discover (default if not specified, discover field type on parseability). Eg. field: String,field2: double |
discover for all additional fields |
mdcFields | Send additional fields whose values are obtained from MDC. Name of the Fields are comma-separated. Example: mdcFields: Application,Version,SomeOtherFieldName |
none |
dynamicMdcFields | Dynamic MDC Fields allows you to extract MDC values based on one or more regular expressions. Multiple regexes are comma-separated. The name of the MDC entry is used as GELF field name. | none |
dynamicMdcFieldTypes | Pattern-based type specification for additional and MDC fields. Key-value pairs are comma-separated. Example: my_field.*=String,business\..*\.field=double |
none |
includeFullMdc | Include all fields from the MDC. | false |
maximumMessageSize | Maximum message size (in bytes). If the message size is exceeded, the appender will submit the message in multiple chunks. | 8192 |
timestampPattern | Date/time pattern for the Time field |
yyyy-MM-dd HH:mm:ss,SSS |
The only mandatory field is host
. All other fields are optional.
Preliminary Steps
If you want to get started with the logstash-gelf support for WildFly Swarm/Thorntail, you will need to integrate logstash-gelf as a module within the server. It is possible to create the module manually, but it's easier to use the prepackaged binary and extract the module.xml
file.
Please follow the steps to integrate the module:
- Obtain the logging module from [Maven](http://search.maven.org/remotecontent?filepath: biz/paluch/logging/logstash-gelf/1.15.1/logstash-gelf-1.15.1-logging-module.zip) or Github
- Extract the module to and copy
module-thorntail.xml
tosrc/main/resources/modules/biz/paluch/logging/main/module.xml
. - Configure the logging subsystem using
src/main/resources/project-stages.yml
:
Logging Configuration
project-stages.yml
:
swarm:
logging:
custom-handlers:
GelfLogger:
attribute-class: biz.paluch.logging.gelf.wildfly.WildFlyGelfLogHandler
module: biz.paluch.logging
properties:
host: "udp:localhost"
port: 12201
version: "1.0"
facility: "logstash-gelf"
extractStackTrace: true
filterStackTrace: true
includeLocation: true
mdcProfiling: true
timestampPattern: "yyyy-MM-dd HH:mm:ss,SSS"
maximumMessageSize: 8192
additionalFields: "fieldName1=fieldValue1,fieldName2=fieldValue2"
additionalFieldTypes: "fieldName1=String,fieldName2=Double,fieldName3=Long"
MdcFields: "mdcField1,mdcField2"
dynamicMdcFields: "mdc.*,(mdc|MDC)fields"
dynamicMdcFieldTypes: "my_field.*=String,business\..*\.field=double"
includeFullMdc: true
root-logger:
level: INFO
handlers:
- GelfLogger