Skip to content

Commit

Permalink
SPARK-25281 Add logstash json logs
Browse files Browse the repository at this point in the history
  • Loading branch information
karolostaszewski committed Nov 27, 2020
1 parent bdd6990 commit 378401a
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
3 changes: 2 additions & 1 deletion LICENSE-THIRD-PARTY.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Lists of 154 third-party dependencies.
Lists of 155 third-party dependencies.
(Eclipse Public License - v 1.0) (GNU Lesser General Public License) Logback Classic Module (ch.qos.logback:logback-classic:1.2.3 - http://logback.qos.ch/logback-classic)
(Eclipse Public License - v 1.0) (GNU Lesser General Public License) Logback Core Module (ch.qos.logback:logback-core:1.2.3 - http://logback.qos.ch/logback-core)
(The Apache License, Version 2.0) spock-reports (com.athaydes:spock-reports:1.7.1 - https://github.com/renatoathaydes/spock-reports)
Expand Down Expand Up @@ -56,6 +56,7 @@ Lists of 154 third-party dependencies.
(Apache License, Version 2.0) Byte Buddy (without dependencies) (net.bytebuddy:byte-buddy:1.10.14 - https://bytebuddy.net/byte-buddy)
(Apache License, Version 2.0) Byte Buddy agent (net.bytebuddy:byte-buddy-agent:1.10.14 - https://bytebuddy.net/byte-buddy-agent)
(Apache License v2.0) (LGPL, version 2.1) Java Native Access (net.java.dev.jna:jna:5.2.0 - https://github.com/java-native-access/jna)
(Apache License, Version 2.0) (MIT License) Logstash Logback Encoder (net.logstash.logback:logstash-logback-encoder:6.4 - https://github.com/logstash/logstash-logback-encoder)
(The Apache Software License, Version 2.0) ASM based accessors helper used by json-smart (net.minidev:accessors-smart:1.2 - http://www.minidev.net/)
(The Apache Software License, Version 2.0) JSON Small and Fast Parser (net.minidev:json-smart:2.3 - http://www.minidev.net/)
(Apache License, Version 2.0) Apache Commons Compress (org.apache.commons:commons-compress:1.20 - https://commons.apache.org/proper/commons-compress/)
Expand Down
27 changes: 27 additions & 0 deletions appstore-metadata-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@
<scmCommit>latest</scmCommit>
</properties>

<profiles>
<profile>
<id>dev</id>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -97,9 +112,21 @@
<artifactId>micrometer-registry-prometheus</artifactId>
<version>${micrometer.version}</version>
</dependency>

<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>${logstash.logback.encoder.version}</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
spring.profiles.active[email protected]@
spring.jackson.default-property-inclusion=NON_NULL
database.host=${JDBC_HOST:localhost}
database.name=${JDBC_DATABASE_NAME:postgres}
Expand Down
41 changes: 41 additions & 0 deletions appstore-metadata-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<configuration>
<springProfile name="dev">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
<logger name="com.lgi.appstore.metadata" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
</springProfile>
<springProfile name="prod">
<appender name="jsonConsoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSSXXX</timestampPattern>
<customFields>{
"app":"${APP_NAME:-not defined}",
"app_version":"${APP_VERSION:-not defined}",
"app_revision":"${APP_REVISION:-not defined}",
"app_branch":"${APP_BRANCH:-not defined}",
"stack":"${STACK_NAME:-not defined}"
}
</customFields>
<fieldNames>
<levelValue>[ignore]</levelValue>
<version>[ignore]</version>
<thread>thread</thread>
<stackTrace>exception</stackTrace>
</fieldNames>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="jsonConsoleAppender"/>
</root>
</springProfile>
</configuration>
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<springdoc-openapi-ui-version>1.4.3</springdoc-openapi-ui-version>
<junit-version>5.6.2</junit-version>
<maven-surefire-version>2.22.2</maven-surefire-version>
<logstash.logback.encoder.version>6.4</logstash.logback.encoder.version>
<skipUTs>false</skipUTs>
<registry.url>set_for_pushing_docker_image</registry.url>
<registry.namespace>set_for_pushing_docker_image</registry.namespace>
Expand Down Expand Up @@ -93,6 +94,15 @@
<skipFTs>true</skipFTs>
</properties>
</profile>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>prod</id>
</profile>
</profiles>

<dependencyManagement>
Expand Down

0 comments on commit 378401a

Please sign in to comment.