generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
426 additions
and
66 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
41 changes: 41 additions & 0 deletions
41
...ment/src/test/java/io/quarkiverse/logging/splunk/LoggingSplunkNamedHandlerConfigTest.java
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,41 @@ | ||
/* | ||
Copyright (c) 2023 Amadeus s.a.s. | ||
Contributor(s): Kevin Viet, Romain Quinio, Yohann Puyhaubert (Amadeus s.a.s.) | ||
*/ | ||
package io.quarkiverse.logging.splunk; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import org.jboss.logging.Logger; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import static org.mockserver.model.JsonBody.json; | ||
|
||
class LoggingSplunkNamedHandlerConfigTest extends AbstractMockServerTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest unitTest = new QuarkusUnitTest() | ||
.withConfigurationResource("application-splunk-logging-named-handler.properties") | ||
.withConfigurationResource("mock-server.properties") | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); | ||
|
||
static final Logger logger = Logger.getLogger(LoggingSplunkNamedHandlerConfigTest.class); | ||
|
||
static final Logger monitoringLogger = Logger.getLogger("monitoring"); | ||
|
||
@Test | ||
void indexWithDefaultLoggerAndNamedLogger() { | ||
logger.warn("hello splunk"); | ||
monitoringLogger.info("{\"key\":\"value\"}"); | ||
awaitMockServer(); | ||
httpServer.verify(requestToJsonEndpoint() | ||
.withBody(json("{ index: 'mylogindex'}")) | ||
.withHeader("Authorization", "Splunk 12345678-1234-1234-1234-1234567890AB")); | ||
httpServer.verify(requestToJsonEndpoint() | ||
.withBody(json("{ index: 'mystatsindex'}")) | ||
.withHeader("Authorization", "Splunk 12345678-0000-0000-0000-1234567890AB")); | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
deployment/src/test/resources/application-splunk-logging-named-handler.properties
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,11 @@ | ||
quarkus.log.handler.splunk.enabled=true | ||
quarkus.log.handler.splunk.token=12345678-1234-1234-1234-1234567890AB | ||
quarkus.log.handler.splunk.level=WARN | ||
quarkus.log.handler.splunk.format=%s%e | ||
quarkus.log.handler.splunk.metadata-index=mylogindex | ||
quarkus.log.handler.splunk."MONITORING".enable=true | ||
quarkus.log.handler.splunk."MONITORING".token=12345678-0000-0000-0000-1234567890AB | ||
quarkus.log.handler.splunk."MONITORING".level=INFO | ||
quarkus.log.handler.splunk."MONITORING".metadata-index=mystatsindex | ||
quarkus.log.category."monitoring".handlers=MONITORING | ||
quarkus.log.category."monitoring".level=INFO |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
quarkus.log.handler.splunk.url=https://localhost:8099 | ||
quarkus.log.handler.splunk.index=main | ||
quarkus.log.handler.splunk.metadata-index=main | ||
quarkus.log.handler.splunk.token=29fe2838-cab6-4d17-a392-37b7b8f41f75 | ||
quarkus.log.handler.splunk.batch-interval=1s | ||
quarkus.log.handler.splunk.disable-certificate-validation=true | ||
quarkus.log.console.enable=true | ||
quarkus.log.handler.splunk.serialization=nested | ||
quarkus.log.handler.splunk.serialization=nested |
Oops, something went wrong.