Skip to content

Commit

Permalink
1.7.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Pierson committed Jan 13, 2024
1 parent b2d92c1 commit 621bac9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,16 @@
(2023-11-10)

* Headers case insensitive
* Upgrade to latest versions
* Upgrade to latest versions

### 1.7.0

(2024-01-13)

* Native handling of values
* All Log Elements return now native objects if possible
* String based Appenders have to stringify themselves
* Appenders that understand native objects benefit from this change
* **BREAKING CHANGE**: `Appender.push` signature changed and simplified - only relevant if you have a custom Appender
* Upgrade to Vert.x 4.5.1 -> Ready for Virtual Threads
* Automatic injection of `timestamp` for `ElasticSearchAppender` - no need anymore to define it artifically in logPattern
12 changes: 8 additions & 4 deletions ES_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ As configuration is now done by plain JsonObject its very simple to use and inje
```yaml
configurations:
- identifier: accesslog-plain
logPattern: "%{msec}t %D cs-uri"
logPattern: "%D cs-uri"
appenders:
- appenderClassName : com.romanpierson.vertx.web.accesslogger.appender.elasticsearch.impl.ElasticSearchAppender
config:
instanceIdentifier: accesslog
fieldNames:
- timestamp
- duration
- uri
```
## Conventions
By default all log elements configured will be sent to the indexer to be interpreted as message to be indexed. However the timestamp is passed to the indexer as meta data as the indexer potentially requires that raw value eg to determinate the target index name.
By default you should put as first element plain timestamp %{msec} and the appender will remove that element from the message sent to the indexer.
The instance identifier tells the indexer verticle to what ES instance the data should be indexed. All the detailed configuration of this is done directly on the indexer verticle itself (so the appender does not have to know about this).
## Timestamp
The timestamp value is automatically added - there is no need to add this on the logPattern.
The real fieldname used in the indexer for the ES timestamp field is configured in the indexer verticle itself.
## Field Names Definition
As for each field to be indexed a specific name needs to be used this has to be explicitly set by configuration property `fieldNames`. Be aware that you need to put a name for all fields of your logpattern even for eg the timestamp one that is actually skipped at the end. The real fieldname used in the indexer for the ES timestamp field is configured in the indexer verticle itself.
As for each field to be indexed a specific name needs to be used this has to be explicitly set by configuration property `fieldNames`. Be aware that you need to put a name for all fields of your logpattern.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ Just add it as a dependency to your project (gradle example)

```xml
dependencies {
compile 'com.romanpierson:vertx-web-accesslog:1.6.0'
compile 'com.romanpierson:vertx-web-accesslog:1.7.0'
}
```

## Compatibility with Vertx core

Accesslog version | Vertx version
----|------
1.7.0 | 4.5.1 >
1.6.0 | 4.3.0 >
1.5.0 | 4.2.0 >
1.4.0 | 4.0.0 - 4.1.x
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}

jar.archiveFileName = "vertx-web-accesslog-1.7.0-RC1.jar"
jar.archiveFileName = "vertx-web-accesslog-1.7.0.jar"

java {
withSourcesJar()
Expand All @@ -56,7 +56,7 @@ publishing {

groupId 'com.romanpierson'
artifactId 'vertx-web-accesslog'
version '1.7.0-RC1'
version '1.7.0'

from components.java

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private void log(final RoutingContext context, long startTSmillis){
.put(Data.Type.URI.getFieldName(), request.path())
.put(Data.Type.VERSION.getFieldName(), request.version())
.put(Data.Type.REMOTE_HOST.getFieldName(), request.remoteAddress().host())
.put(Data.Type.LOCAL_HOST.getFieldName(), request.host().contains(":") ? request.host().substring(0, request.host().indexOf(":")): request.host())
.put(Data.Type.LOCAL_HOST.getFieldName(), request.authority() == null ? null : request.authority().host())
.put(Data.Type.LOCAL_PORT.getFieldName(), request.localAddress().port());

if(request.query() != null && !request.query().trim().isEmpty()){
Expand Down

0 comments on commit 621bac9

Please sign in to comment.