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 4 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
9 changes: 9 additions & 0 deletions gradle/check-licenses.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ downloadLicenses {
reportByLicenseType = true
dependencyConfiguration = 'testCompile'

ext.epl1 = license('Eclipse Public License 1.0', 'https://www.eclipse.org/legal/epl-v10.html')
ext.apache = license('Apache License, Version 2.0', 'http://opensource.org/licenses/Apache-2.0')
ext.mit = license('MIT License', 'http://www.opensource.org/licenses/mit-license.php')
ext.bsd = license('BSD License', 'http://www.opensource.org/licenses/bsd-license.php')
ext.bsd3Clause = license('BSD 3-Clause', 'http://opensource.org/licenses/BSD-3-Clause')
ext.cddl = license('Common Development and Distribution License 1.0', 'http://opensource.org/licenses/CDDL-1.0')
ext.cc0 = license('Public Domain (CC0) License 1.0', 'https://creativecommons.org/publicdomain/zero/1.0')
aliases = [
(epl1) : [
'Eclipse Public License - v 1.0',
'Eclipse Public License 1.0',
],
(apache) : [
'The Apache Software License, Version 2.0',
'The Apache Software License, version 2.0',
Expand Down Expand Up @@ -108,6 +113,10 @@ downloadLicenses {
// RocksDB is dual licensed under Apache v2.0 and GPL 2 licenses
// Explicitly declare that we are using the Apache v2.0 license
(group('org.rocksdb')) : apache,

// Logback is dual licensed under EPL v1.0 and LGPL v2.1
// Explicitly declare that we are using the EPL v1.0 license
(group('ch.qos.logback')) : epl1,
]
}

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