Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add splunk logging #725

Merged
merged 5 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions besu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies {
implementation 'org.springframework.security:spring-security-crypto'

runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
runtimeOnly 'com.splunk.logging:splunk-library-javalogging'

testImplementation project(path: ':ethereum:core', configuration: 'testSupportArtifacts')
testImplementation project(path: ':crypto', configuration: 'testSupportArtifacts')
Expand Down
40 changes: 37 additions & 3 deletions besu/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Properties>
<Property name="root.log.level">INFO</Property>
<Property name="root.log.level">${env:LOG_LEVEL:-INFO}</Property>
<Property name="root.log.logger">${env:LOGGER:-Console}</Property>
<Property name="host">${env:HOST:-${docker:containerId:-localhost}}</Property>
<Property name="splunk.url">${env:SPLUNK_URL}</Property>
<Property name="splunk.token">${env:SPLUNK_TOKEN}</Property>
<Property name="splunk.index">${env:SPLUNK_INDEX}</Property>
<Property name="splunk.source">${env:SPLUNK_SOURCE:-besu}</Property>
<Property name="splunk.sourcetype">${env:SPLUNK_SOURCETYPE:-besu}</Property>
<Property name="splunk.batch_size_bytes">${env:SPLUNK_BATCH_SIZE_BYTES:-65536}</Property>
<Property name="splunk.batch_size_count">${env:SPLUNK_BATCH_SIZE_COUNT:-1000}</Property>
<Property name="splunk.batch_interval">${env:SPLUNK_BATCH_INTERVAL:-500}</Property>
<Property name="splunk.disableCertificateValidation">${env:SPLUNK_SKIPTLSVERIFY:-false}</Property>
</Properties>

<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSSZZZ} | %t | %-5level | %c{1} | %msg%n" /> </Console>
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSSZZZ} | %t | %-5level | %c{1} | %msg%n" />
</Console>

<SplunkHttp name="Splunk"
url="${sys:splunk.url}"
token="${sys:splunk.token}"
host="${sys:host}"
index="${sys:splunk.index}"
source="${sys:splunk.source}"
sourcetype="${sys:splunk.sourcetype}"
messageFormat="text"
batch_size_bytes="${sys:splunk.batch_size_bytes}"
batch_size_count="${sys:splunk.batch_size_count}"
batch_interval="${sys:splunk.batch_interval}"
disableCertificateValidation="${sys:splunk.disableCertificateValidation}">
<PatternLayout pattern="%msg"/>
</SplunkHttp>

<Routing name="Router">
<Routes pattern="$${sys:root.log.logger}">
<Route ref="Console" key="Console" />
<Route ref="Splunk" key="Splunk" />
</Routes>
</Routing>
</Appenders>
<Loggers>
<Root level="${sys:root.log.level}">
<AppenderRef ref="Console" />
<AppenderRef ref="Router" />
</Root>
</Loggers>
</Configuration>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ allprojects {
mavenCentral()
mavenLocal()
maven { url "https://consensys.bintray.com/pegasys-repo" }
maven { url "https://repository.apache.org/content/repositories/snapshots/" }
maven { url "https://repo.spring.io/libs-release" }
}

dependencies { errorprone "com.google.errorprone:error_prone_core" }
Expand Down
2 changes: 2 additions & 0 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ dependencyManagement {

dependency 'com.graphql-java:graphql-java:13.0'

dependency 'com.splunk.logging:splunk-library-javalogging:1.8.0'

dependency 'com.squareup.okhttp3:okhttp:4.2.2'

dependency 'commons-cli:commons-cli:1.4'
Expand Down