From 621bac99905d8d4c62c46e11007c6b459ddab426 Mon Sep 17 00:00:00 2001 From: Roman Pierson Date: Sat, 13 Jan 2024 19:43:44 +0100 Subject: [PATCH] 1.7.0 release --- CHANGELOG.md | 14 +++++++++++++- ES_README.md | 12 ++++++++---- README.md | 3 ++- build.gradle | 4 ++-- .../accesslogger/impl/AccessLoggerHandlerImpl.java | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 291df34..42a0ab3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,4 +61,16 @@ (2023-11-10) * Headers case insensitive -* Upgrade to latest versions \ No newline at end of file +* 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 diff --git a/ES_README.md b/ES_README.md index b2cfb70..ccb2c17 100644 --- a/ES_README.md +++ b/ES_README.md @@ -8,13 +8,12 @@ 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 ``` @@ -22,10 +21,15 @@ configurations: ## 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. diff --git a/README.md b/README.md index e9f6284..09c4f0a 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ 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' } ``` @@ -39,6 +39,7 @@ dependencies { 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 diff --git a/build.gradle b/build.gradle index 651e1db..d4db930 100755 --- a/build.gradle +++ b/build.gradle @@ -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() @@ -56,7 +56,7 @@ publishing { groupId 'com.romanpierson' artifactId 'vertx-web-accesslog' - version '1.7.0-RC1' + version '1.7.0' from components.java diff --git a/src/main/java/com/romanpierson/vertx/web/accesslogger/impl/AccessLoggerHandlerImpl.java b/src/main/java/com/romanpierson/vertx/web/accesslogger/impl/AccessLoggerHandlerImpl.java index d709eb4..033ebf1 100644 --- a/src/main/java/com/romanpierson/vertx/web/accesslogger/impl/AccessLoggerHandlerImpl.java +++ b/src/main/java/com/romanpierson/vertx/web/accesslogger/impl/AccessLoggerHandlerImpl.java @@ -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()){