-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Access log documentation fix * Minor reference fix * Common parts extracted (access log config)
- Loading branch information
1 parent
0455440
commit 84123e8
Showing
3 changed files
with
134 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
Copyright (c) 2022 Oracle and/or its affiliates. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
ifndef::rootdir[:rootdir: {docdir}/../..] | ||
:description: Access Log Config | ||
:keywords: helidon, webserver, access, log | ||
== Configuration Options | ||
The following configuration options can be defined: | ||
[cols="2,2,2,5", role="flex, sm10"] | ||
|=== | ||
|Config key |Default value |Builder method |Description | ||
|`enabled` |`true` |`enabled(boolean)` |When this option is set to `false`, access logging will be disabled | ||
|`logger-name` |`io.helidon.webserver.AccessLog` |`loggerName(String)` |Name of the logger to use when writing log entries | ||
|`format` |`helidon` |`helidonLogFormat()`, `commonLogFormat()`, `add(AccessLogEntry entry)` |Configuration of access log output, | ||
when `helidon` is defined, the Helidon log format (see below) is used. | ||
Can be configured to explicitly define log entries (see below as well) | ||
|`exclude-paths`|N/A|`excludePaths(List<String>)` | List of path patterns to exclude from access log. Path pattern syntax is as | ||
defined in `io.helidon.webserver.PathMatcher`. Can be used to exclude | ||
paths such as `/health` or `/metrics` to avoid cluttering log. | ||
|=== | ||
== Supported Log Formats | ||
=== Supported Log Entries | ||
The following log entries are supported in Helidon: | ||
[cols="2,2,5",role="flex, sm7"] | ||
|=== | ||
|Config format |Class (to use with builder) |Description | ||
|%h |`HostLogEntry` |IP address of the remote host | ||
|%l |`UserIdLogEntry` |Client identity, always undefined in Helidon | ||
|%u |`UserLogEntry` |The username of logged-in user (when Security is used) | ||
|%t |`TimestampLogEntry` |The current timestamp | ||
|%r |`RequestLineLogEntry` |The request line (method, path and HTTP version) | ||
|%s |`StatusLogEntry` |The HTTP status returned to the client | ||
|%b |`SizeLogEntry` |The response entity size (if available) | ||
|%D |`TimeTakenLogEntry` |The time taken in microseconds | ||
|%T |`TimeTakenLogEntry` |The time taken in seconds | ||
|%{`header-name`}i |`HeaderLogEntry` |Value of a header (can have multiple such specification to write | ||
multiple headers) | ||
|=== | ||
Currently we only support the entries defined above, with NO support for free text. | ||
=== Helidon Log Format | ||
When format is set to `helidon`, the format used is: | ||
`"%h %u %t %r %s %b %D"` | ||
The entries logged: | ||
1. IP Address | ||
2. Username of a logged-in user | ||
3. Timestamp | ||
4. Request Line | ||
5. HTTP Status code | ||
6. Entity size | ||
7. Time taken (microseconds) | ||
Access log example: | ||
[source, listing] | ||
---- | ||
192.168.0.104 - [18/Jun/2019:22:28:55 +0200] "GET /greet/test HTTP/1.1" 200 53 | ||
0:0:0:0:0:0:0:1 - [18/Jun/2019:22:29:00 +0200] "GET /metrics/vendor HTTP/1.1" 200 1658 | ||
0:0:0:0:0:0:0:1 jack [18/Jun/2019:22:29:07 +0200] "PUT /greet/greeting HTTP/1.1" 200 21 | ||
0:0:0:0:0:0:0:1 jill [18/Jun/2019:22:29:12 +0200] "PUT /greet/greeting HTTP/1.1" 403 0 | ||
0:0:0:0:0:0:0:1 - [18/Jun/2019:22:29:17 +0200] "PUT /greet/greeting HTTP/1.1" 401 0 | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters