Skip to content

Commit

Permalink
feat: integrate with Splunk
Browse files Browse the repository at this point in the history
  • Loading branch information
thongdanghoang committed Feb 25, 2025
1 parent 81830ef commit ad877c6
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sep490-enterprise/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ java {

repositories {
mavenCentral()
maven {
url 'https://splunk.jfrog.io/splunk/ext-releases-local'
}
}

dependencies {
Expand All @@ -38,6 +41,11 @@ dependencies {

// Ops
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
implementation 'com.splunk.logging:splunk-library-javalogging:1.11.8'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'

// Database
implementation 'org.springframework.boot:spring-boot-starter-validation'
Expand Down
33 changes: 33 additions & 0 deletions sep490-enterprise/src/main/resources/log4j2-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="%style{%d{ISO8601}} %highlight{%-5level }[%style{%t}{bright,blue}]
%style{%C{10}}{bright,yellow}: %msg%n%throwable"/>
</Console>
<SplunkHttp
name="splunkhttp"
url="${SPLUNK_URL}"
token="${ENTERPRISE_SPLUNK_TOKEN}"
host="${SPLUNK_HOST}"
index="${ENTERPRISE_SPLUNK_INDEX}"
source="${ENTERPRISE_SPLUNK_SOURCE}"
type="raw"
sourcetype="log4j"
messageFormat="text"
disableCertificateValidation="true">
<PatternLayout pattern="%d{ISO8601} %-5p [%t] %c: %m%n"/>
<MetaData>
<Application>GreenBuildings Enterprise</Application>
</MetaData>
</SplunkHttp>
</Appenders>

<Loggers>
<Root level="info">
<AppenderRef ref="console"/>
<AppenderRef ref="splunkhttp"/>
</Root>
</Loggers>
</Configuration>
8 changes: 8 additions & 0 deletions sep490-idp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ configurations {

repositories {
mavenCentral()
maven {
url 'https://splunk.jfrog.io/splunk/ext-releases-local'
}
}

dependencies {
Expand All @@ -48,6 +51,11 @@ dependencies {

// Ops
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
implementation 'com.splunk.logging:splunk-library-javalogging:1.11.8'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'

// Database
implementation 'org.springframework.boot:spring-boot-starter-validation'
Expand Down
33 changes: 33 additions & 0 deletions sep490-idp/src/main/resources/log4j2-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="%style{%d{ISO8601}} %highlight{%-5level }[%style{%t}{bright,blue}]
%style{%C{10}}{bright,yellow}: %msg%n%throwable"/>
</Console>
<SplunkHttp
name="splunkhttp"
url="${SPLUNK_URL}"
token="${IDP_SPLUNK_TOKEN}"
host="${SPLUNK_HOST}"
index="${IDP_SPLUNK_INDEX}"
source="${IDP_SPLUNK_SOURCE}"
type="raw"
sourcetype="log4j"
messageFormat="text"
disableCertificateValidation="true">
<PatternLayout pattern="%d{ISO8601} %-5p [%t] %c: %m%n"/>
<MetaData>
<Application>GreenBuildings Identity Provider</Application>
</MetaData>
</SplunkHttp>
</Appenders>

<Loggers>
<Root level="info">
<AppenderRef ref="console"/>
<AppenderRef ref="splunkhttp"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit ad877c6

Please sign in to comment.