Main log format
This article describes the log line format of logs written by the MAIN appender for each IAM module (web server, access, structured, parsable, etc. logs use different formats).
Note that the parsable log file variants (e.g. loginapp-parsable.log
) are used by the Airlock IAM log viewer.
They must not be used by other systems as the format (and the location of the data) may change without notice.
Example log lines
Log lines not caused by a HTTP request: there is no SID (session ID) and no RID (request ID):
2018-01-29 09:08:15,644 INFO [IAM - auth - adminapp - SID: 000000000000000000 - RID: 000000000000000000] | 001 Configuration: ***** ADMINAPP MODULE: ACTIVATING *****
2018-01-29 09:08:15,644 INFO [IAM - auth - adminapp - SID: 000000000000000000 - RID: 000000000000000000] | 001 Configuration: Version: 8.0
Multi-line log lines showing an exception (showing only the first few lines):
2018-01-29 10:02:22,247 ERROR [IAM - auth - loginapp - SID: 906927719100591752 - RID: 270869843594473181] | 001 ProvisionExceptionMapper: Error in custom provider, com.airlock.iam.common.api.domain.model.store.exception.StoreFailureException: The store com.airlock.iam.core.infrastructure.store.user.db.DatabaseUserStore@5244e506 encountered an exception 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 001 LogUtils: 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 002 ---------------| BEGIN OF EXCEPTION |--------------- 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 003 Exception-Type : com.airlock.iam.common.api.domain.model.store.exception.StoreFailureException 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 004 Message : The store com.airlock.iam.core.infrastructure.store.user.db.DatabaseUserStore@452d2fa6 encountered an exception 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 005 Cause Message : Error while searching user with name "jdoe" (getting connection from data source): HikariPool-6 - Connection is not available, request timed out after 5001ms. 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 006 Cause Message : HikariPool-6 - Connection is not available, request timed out after 5001ms. 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 007 Connection is broken: "java.net.ConnectException: Connection refused: localhost:9001" [90067-176] 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 008 Cause Message : Connection refused 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 009 Stack-Trace : 2018-01-29 10:02:22,247 WARN [IAM - auth - loginapp - SID: 906927719100591752 - RID: 206556668324927646] | 010 com.airlock.iam.core.infrastructure.store.user.persister.PersisterBasedUserStore.getByIdentity(PersisterBasedUserStore.java:67) ...
Default log pattern
The default log pattern is:%d{DEFAULT} %-5p [IAM - ${sys:iam.instance.name} - ${web:initParam.CONTEXT_ID} - SID: %18e{mdc:GSID:0} - RID: %18e{mdc:REQUEST_ID:0}] | %e{header:3}%c{1}: %m%n
The following table describes the default pattern:
Pattern | Example | Description | Length |
---|---|---|---|
|
| Log timestamp in ISO-8601 format: | 24 |
|
| Log priority can be INFO, WARN, ERROR, and FATAL. Log priority must be padded with spaces to be 5 characters long. | 5 |
|
| Log system, may be referenced in custom legacy log patterns. Value is always “IAM”. | 3 |
|
| Name of the instance. | any |
|
| Name of the Airlock IAM application module. | any |
|
| Session ID of the logged session. | >= 18 |
|
| Request ID of the logged request. | >= 18 |
|
| Line sequence number: numbers lines in multiline messages such as exception stack traces. | >=3 |
|
| Name of the class (no package information) containing the log statement. | any |
|
| Actual log message | any |
| Line separator (platform dependent) | 1-2 |
Custom log patterns
In custom log patterns, any conversion pattern supported by Log4j2 can be used. For example, any application parameter, like iam.environment.id
can be included with ${sys:iam.environment.id}
“.
The pattern in the instance.properties file requires all colons (:) to be escaped with a leading backslash (\).
For example:${sys\:iam.environment.id}
The following table describes some custom log patterns:
Pattern | Example | Description | Length |
---|---|---|---|
| 42 | This custom log pattern allows logging the value of the correlation ID in the Main log. For more information on the Correlation ID feature, see Correlation ID for better traceability. | 2-256 |