https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
http4k
  • d

    David Hamilton

    01/26/2022, 2:09 PM
    Hi. We've noticed that the latest version of
    http4k-server-jetty
    is pulling in (through Jetty itself) an alpha version of SLF4J 2.0 as a transitive dependency (and that there seem to be conflicts with SLF4J 1.x). Anyone else notice that - and have a workaround? Does it just need an exclusion? 😄
    d
    j
    • 3
    • 2
  • c

    christophsturm

    02/08/2022, 8:14 PM
    thats what i thought, thanks. mocking and http4k seemed like a strange combination
    d
    • 2
    • 1
  • d

    dave

    02/09/2022, 1:02 PM
    If anyone would like to by the exclusive NFT of the first commit then we'll be listing it on OpenSea soon.. 😉
    😂 4
    c
    • 2
    • 2
  • d

    dave

    02/14/2022, 8:38 AM
    It's always nice to be featured in these types of list, especially when you're the outlier which isn't backed by some large corporation 🙃 :

    https://youtu.be/pYK5KkuZ3aU▾

    🎉 17
    :yes: 1
    c
    • 2
    • 3
  • e

    Elizabeth Thomas

    03/03/2022, 6:09 PM
    This is for pagination responses where we want to send a custom header to indicate the number of times this response can be called to get the complete data.
    d
    • 2
    • 1
  • m

    Marc

    03/18/2022, 1:49 PM
    hi i have a question about contracts. it is pretty easy to nest routes with the normal router, but i'm not sure what syntax to use to nest contracts (ie: all endpoints share the same path segment). example (not working):
    "/tokens" bind contract {
                routes += TokenID.path bind contract {
                    routes += "/" bindContract GET to ::getToken
                    routes += "/"  bindContract GET to ::getToken
                    routes += "/"  bindContract PUT to ::putToken
                    routes += "/"  bindContract DELETE to ::removeToken
                    routes += "/user" bindContract GET to ::getUser
                }
            }
    d
    • 2
    • 2
  • m

    Marc

    03/18/2022, 1:49 PM
    TokenID.path is the lens, all functions take a token id
    d
    • 2
    • 8
  • d

    Dan T

    03/21/2022, 3:45 PM
    Question/request about the listener IP address for Undertow: I see this PR was rejected: https://github.com/http4k/http4k/pull/649 I have a similar use case that seems pretty common and critical from a security perspective: We use a security sidecar pattern on the host that forwards requests to our HTT4K server including authorization headers. I can't have the server listen on
    0.0.0.0
    , and I don't see a way to modify the configuration using the ServerConfig object. So the only option I'm aware of currently is to create my own class similar to Undertow. Before I do that, I thought I'd double-check in case I'm missing something or this use case changes the perspective. Thanks.
    d
    • 2
    • 4
  • d

    David Hamilton

    03/22/2022, 6:38 PM
    Hi. I'm trying to return content based on (optional)
    Accept
    header provided by client, providing json content only when specifically requested by the client. However both my routes are now returning
    405
    whereas the fallback handler worked fine without the nested route:
    "/mappings" bind routes(
                    Method.GET to routes(
                        header("Accept", "application/json") bind ingressTracingLoggingFilter.then(mappingsAdminJsonHandler),
                        Fallback bind ingressTracingLoggingFilter.then(mappingsAdminReportHandler)
                    ),
                    <http://Method.POST|Method.POST> to someOtherHandler
                ),
    What am I doing wrong?
    d
    • 2
    • 8
  • m

    MrNiamh

    03/23/2022, 2:00 PM
    Hey, if I wanted to expose one microservice’s API as a client to another service, has anyone got any good examples?
    d
    • 2
    • 6
  • m

    Marc

    03/29/2022, 1:56 PM
    hi everyone! i need opinion. i am enjoying http4k very much, specially the simplicity of the API. imagine i want to build a ws which has many events coming in and out (different sources in the background etc), my mind goes with reactive as it would be a natural way of thinking about flows of events. what would you suggest to use? callback hell from the socket handler, kotlin flow and trigger a coroutine from the handler and deal with flows from there back, rxjava/reactor or something else.
    f
    • 2
    • 3
  • d

    DanielZ

    04/01/2022, 9:26 AM
    Hi, I have some difficulties with
    Environment
    in following example the second test fails:
    import com.github.stefanbirkner.systemlambda.SystemLambda
    import com.natpryce.hamkrest.assertion.assertThat
    import com.natpryce.hamkrest.equalTo
    import org.http4k.cloudnative.env.Environment
    import org.http4k.cloudnative.env.EnvironmentKey
    import org.http4k.cloudnative.env.Port
    import org.http4k.lens.string
    import org.junit.jupiter.api.Test
    
    private val developmentPort = Port(9999)
    private val defaultPort = Port(8080)
    
    private const val developmentProfile = "development"
    private const val SPRING_PROFILE_ACTIVE = "SPRING_PROFILE_ACTIVE"
    
    private val springProfileLens = EnvironmentKey.string().defaulted(SPRING_PROFILE_ACTIVE, "")
    
    class ConfigurationTest {
        @Test
        fun configuration1() {
            assertThat(Configuration.serverPort, equalTo(defaultPort))
        }
    
        @Test
        fun configuration2() {
            SystemLambda.withEnvironmentVariable(SPRING_PROFILE_ACTIVE, developmentProfile).execute {
                assertThat(Configuration.serverPort, equalTo(developmentPort))
            }
        }
    
        @Test
        fun configuration3() {
            assertThat(Configuration.serverPort, equalTo(defaultPort))
        }
    }
    
    
    object Configuration {
        val serverPort: Port
            get() {
                println("selected profile: ${springProfileLens(environment)}")
                println("selected profile (env): ${System.getenv(SPRING_PROFILE_ACTIVE).orEmpty()}")
                return when (springProfileLens(environment)) {
                    developmentProfile -> developmentPort
                    else -> defaultPort
                }
            }
    
        private val environment: Environment
            get() = Environment.ENV overrides Environment.JVM_PROPERTIES
    }
    For some reasons I don’t understand I receive following output:
    selected profile: 
    selected profile (env): development
    I expected my
    springProfileLens(environment)
    would return
    development
    but it’s not. Do you have an idea where I’m wrong? Thanks a lot
    j
    • 2
    • 2
  • g

    Gopal S Akshintala

    04/05/2022, 4:19 PM
    Hi, request some help on this ☝️🏼
    d
    • 2
    • 10
  • s

    s4nchez

    04/12/2022, 6:43 PM
    So far, in most of the places where we've been involved directly I can say that adoption happened somewhat organically. We are either invited to do talks on http4k or provide consulting on wider topics, so in a sense we never pitch http4k directly but rather use it as a tool to contribute to project success. If I had to pick the biggest pain point we solve is testability, and we've been lucky that most teams we see will quickly embrace http4k when they experience how much simpler it makes to write powerful, super-fast tests. I also never saw people miss their DI framework when they see that wiring an app by hand is easier when you design it sensibly. The kind of resistance we face tends to be either from people not bought into Kotlin yet or those who default to Spring as career choice and are happy to reject anything else. We also get the usual question about async sometimes but in practice I don't remember facing a single production scenario where that turned out to be a problem.
    👍 1
    🙇 1
    p
    j
    • 3
    • 2
  • j

    James Richardson

    04/13/2022, 1:28 PM
    The startup time is something that IMHO is a completely underappreciated feature of high quality systems. Starting a system in some configuration or other, taking a millisecond, completely changes the types and scope of tests that can be run, compared to when starting a component takes 30 seconds or so, which is not uncommon in [frameworks]
    p
    • 2
    • 1
  • m

    MrNiamh

    04/14/2022, 11:52 AM
    Hey, a colleague is trying to run https://www.http4k.org/guide/howto/serve_websockets/ but having some issues when adding it to an existing project (works fine from a new maven project), and are raised at the asServer…start() line. When using Undertow they get:
    Exception in thread "main" java.lang.NoSuchMethodError: 'org.http4k.core.Filter org.http4k.filter.ServerFilters$CatchAll.invoke$default(org.http4k.filter.ServerFilters$CatchAll, kotlin.jvm.functions.Function1, int, java.lang.Object)'
                   at org.http4k.server.Http4kUndertowHttpHandler.<init>(Http4kUndertowHttpHandler.kt:20)
                   at org.http4k.server.Undertow.toServer(Undertow.kt:24)
                   at org.http4k.server.PolyServerConfig$DefaultImpls.toWsServer(PolyServerConfig.kt:15)
                   at org.http4k.server.Undertow.toWsServer(Undertow.kt:19)
                   at org.http4k.server.RealtimeExtensionsKt.wsHandlerAsServer(realtimeExtensions.kt:19)
                   at com.asurafin.trading.mstar.stream.WsPolyTestKt.main(WsPolyTest.kt:62)
                   at com.asurafin.trading.mstar.stream.WsPolyTestKt.main(WsPolyTest.kt)
    When using jetty they get:
    SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
    Exception in thread "main" java.lang.NoSuchMethodError: 'java.util.stream.Stream org.eclipse.jetty.util.TypeUtil.serviceStream(java.util.ServiceLoader)'
                   at org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry.<init>(WebSocketExtensionRegistry.java:33)
                   at org.eclipse.jetty.websocket.core.WebSocketComponents.<init>(WebSocketComponents.java:55)
                   at org.eclipse.jetty.websocket.core.WebSocketComponents.<init>(WebSocketComponents.java:49)
                   at org.eclipse.jetty.websocket.core.WebSocketComponents.<init>(WebSocketComponents.java:43)
                   at org.http4k.server.Jetty.toServer(jetty.kt:38)
                   at org.http4k.server.PolyServerConfig$DefaultImpls.toWsServer(PolyServerConfig.kt:15)
                   at org.http4k.server.Jetty.toWsServer(jetty.kt:26)
                   at org.http4k.server.RealtimeExtensionsKt.wsHandlerAsServer(realtimeExtensions.kt:19)
    They’re still investigating themselves what could be causing it, but just wondering if anyone has seen this before as the exceptions aren’t massively helpful
    s
    d
    • 3
    • 4
  • m

    Michael Hayes

    04/14/2022, 3:27 PM
    hi I’ve created a PolyHandler with a http and WS (see https://www.http4k.org/guide/howto/serve_websockets/) When testing I’m getting the “has been blocked by CORS policy” error. I’ve found the code normally used to set the CORS policy but I’m struggling to apply it to the PolyHandler, can you help?
    CorsPolicy(OriginPolicy.AllowAll(), listOf("content-type", "Authorization"), Method.values().toList(), true)
    d
    • 2
    • 11
  • r

    Raf Szałański

    04/21/2022, 3:21 PM
    Hey! I wonder if there is any way of telling which json fields were missing or had incorrect type when parsing request using lenses. Let’s say my endpoint expects requests three fields:
    id: String
    ,
    name: String
    and
    count: Int
    and the caller forgets to send the
    count
    or maybe sends a boolean there. When parsing such request, http4k will likely throw a lens failure, e.g:
    body 'body' must be object
    org.http4k.lens.LensFailure: body 'body' must be object
    I found this piece of code recently https://github.com/http4k/http4k/blob/master/http4k-core/src/main/kotlin/org/http4k/lens/Validator.kt and thought it’d be fantastic to make it work with json parsing. Unfortunately, I can only see it being used with web forms and not sure it works with json https://github.com/http4k/http4k/blob/master/http4k-core/src/test/kotlin/org/http4k/lens/ValidatorTest.kt
    👋 2
    d
    • 2
    • 6
  • c

    César

    04/23/2022, 8:02 AM
    Hi! I see Azure functions are supported in the serverless module, but I can't find any documentation or example on how to use it. Could anybody point me into something I could use? if I get something working I'd be glad to send a PR with an example and update the documentation
    d
    • 2
    • 2
  • d

    dave

    05/06/2022, 7:00 AM
    Looks like a bug - we purposely don't allow null field values in examples as we introspect the example objects to generate the schema
    a
    • 2
    • 7
  • g

    Gopal S Akshintala

    05/08/2022, 2:47 PM
    Hi, I am facing a classic java cert issue
    PKIX path building failed
    . I migrated from
    JavaHttpClient()
    to
    ApacheClient()
    and built it like this to disable SSL verification. Yet getting the same issue. What am I missing?
    Apache4Client(
              client = HttpClients.custom()
                .setDefaultRequestConfig(
                  RequestConfig.custom()
                    .setRedirectsEnabled(false)
                    .setCookieSpec(CookieSpecs.IGNORE_COOKIES)
                    .build()
                ).setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
                .build()
            )
    This is the exception log:
    javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
    	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:370)
    	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:313)
    	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
    	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:654)
    	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:473)
    	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:369)
    	at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
    	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480)
    	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:458)
    	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:200)
    	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
    	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1500)
    Attached full log in the thread. Here is my usage (it’s a small app): https://github.com/overfullstack/revoman-root/blob/f43bc461e580eae650c84ce179645423118e1eba/src/jvmMain/kotlin/org/revcloud/ReVoman.kt#L84-L84
    • 1
    • 1
  • j

    James Richardson

    05/09/2022, 6:01 AM
    The thing that you are doing doesn't disable ssl verification, it just disables verification of the hostname presented... it will still verify that the certificate presented comes via a trusted path, although the certificate can be for any host. You need to set up an sslcontext with an "accept all" trust strategy too, I'm thinking.
    g
    • 2
    • 1
  • m

    Matt

    05/10/2022, 10:52 AM
    Hello all, in the
    greetRoute()
    example (https://www.http4k.org/guide/reference/contracts/), how would I apply a filter before the
    greet(nameFromPath: String)
    handler is invoked?
    d
    • 2
    • 3
  • p

    Philipp Mayer

    05/15/2022, 5:05 PM
    Out of curiosity, how do you guys trigger scheduled lambda functions? I’m trying playing around with AWS + serverless for the first time in a private project and wanted to trigger a lambda e.g. once a day. I saw in an [aws example repo](https://github.com/cdk-patterns/serverless/blob/main/the-scheduled-lambda/java/src/main/java/com/cdkpatterns/TheScheduledLambdaApp.java) that one can pull in the amazon CDK to have a builder inside the app itself, but I guess this would not work with http4k’s own implementation. So, how do you guys usually do this? I guess I can also trigger it from the outside, but wanted to check first. (Sorry for being partly off-topic here!)
    s
    j
    d
    • 4
    • 26
  • g

    Gopal S Akshintala

    05/17/2022, 1:02 PM
    Basic question:
    urlStr.urlEncoded()
    is turning my URL into this:
    https%3A%2F%<http://2Fpokeapi.co|2Fpokeapi.co>%2Fapi%2Fv2%2Fpokemon%3Flimit%3D10
    which is invalid. What’s the right and http4k idiomatic way to do it?
    s
    j
    • 3
    • 37
  • f

    Fabien Hebuterne

    05/24/2022, 3:46 PM
    Hello, i want to document callback from webhook in OpenApi 3, how to achieved this with http4k please ? I didn’t see anything like that in http4k documentation and Api doesn’t seen to provide any implementation for this (https://swagger.io/docs/specification/callbacks/) ?
    d
    • 2
    • 2
  • s

    Slackbot

    06/01/2022, 9:48 PM
    This message was deleted.
    p
    d
    • 3
    • 23
  • d

    Dmitry Kandalov

    06/06/2022, 6:02 PM
    I understand that http4k is compiled for java 8 but it brings kotlin-stdlib-jdk8 (and kotlin-stdlib-jdk7) as a dependency to any project even if its JDK is > 8. I was wondering if http4k really needs kotlin-stdlib-jdk8 or could depend only on kotlin-stdlib?
    s
    d
    • 3
    • 11
  • d

    dave

    06/06/2022, 6:59 PM
    It's not bundled, but it was there to provide compatibility with any servlet container
    d
    • 2
    • 4
  • d

    DanielZ

    06/09/2022, 7:40 AM
    Hi, I need structured logging with a slightly different format 😕 It should look like:
    {
       "@timestamp": "2022-06-02T12:00:00.0Z",
       "metadata": {...},
       "event": {...}
    }
    What would be the best approach? Basically copying whole
    events.kt
    file and adopt it with a customized
    MetadataEvent
    ? Or is there a better option?
    d
    • 2
    • 3
Powered by Linen
Title
d

DanielZ

06/09/2022, 7:40 AM
Hi, I need structured logging with a slightly different format 😕 It should look like:
{
   "@timestamp": "2022-06-02T12:00:00.0Z",
   "metadata": {...},
   "event": {...}
}
What would be the best approach? Basically copying whole
events.kt
file and adopt it with a customized
MetadataEvent
? Or is there a better option?
d

dave

06/09/2022, 8:10 AM
You could use a filter to wrap the metadata event at the end of the chain?
(and use a custom event which copies the data from it and has the 3 fields you need
d

DanielZ

06/09/2022, 8:13 AM
Cool, haven’t thought about that option. Thanks for this idea 🎉
View count: 14