Skip to content

Commit f5c9a83

Browse files
committed
updated to Splunk 8, and Spring Boot's native docker support
Also fixed logging property which changed in Spring Boot 2.3
1 parent 9785f90 commit f5c9a83

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Sample project to show log forwarding from a [Spring Boot](https://projects.spri
77
Build the application as a [Docker](https://www.docker.com/) image using:
88

99
```bash
10-
mvn clean install
10+
mvn clean package
1111
```
1212

1313
## Run
@@ -20,7 +20,7 @@ docker-compose up
2020

2121
This will bring up three containers: A demo application, Splunk, and a Spunk Forwarder.
2222

23-
Shares are forwarded to Splunk via a shared volume between the application and forwarder.
23+
Logs are forwarded to Splunk via a shared volume between the application and forwarder.
2424

2525
It is possible to send logs to Splunk via Docker's logging mechanism, but the goal here was to use the file forwarder to replicate a production setup.
2626

docker-compose.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ version: '2'
22
services:
33
demo-application:
44
image: barrycommins/spring-boot-sleuth-splunk-demo
5+
user: root # has to run as root user, because it needs to write logs to shared volume
56
environment:
6-
- LOGGING_FILE=/logs/demo-application.log
7+
- LOGGING_FILE_NAME=/logs/demo-application.log
78
ports:
89
- "8080:8080"
910
volumes:
1011
- log_volume:/logs
1112
splunk:
12-
image: splunk/splunk:7.3.0
13+
image: splunk/splunk:8.0
1314
hostname: splunk
1415
environment:
1516
- SPLUNK_START_ARGS=--accept-license
@@ -19,7 +20,7 @@ services:
1920
ports:
2021
- "8000:8000"
2122
splunkforwarder:
22-
image: splunk/universalforwarder:7.3.0
23+
image: splunk/universalforwarder:8.0
2324
hostname: splunkforwarder
2425
environment:
2526
- SPLUNK_START_ARGS=--accept-license --answer-yes

pom.xml

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -80,37 +80,15 @@
8080
<goals>
8181
<goal>repackage</goal>
8282
<goal>build-info</goal>
83+
<goal>build-image</goal>
8384
</goals>
8485
</execution>
8586
</executions>
86-
</plugin>
87-
<plugin>
88-
<groupId>com.spotify</groupId>
89-
<artifactId>docker-maven-plugin</artifactId>
90-
<version>${docker.plugin.version}</version>
91-
<executions>
92-
<execution>
93-
<phase>install</phase>
94-
<goals>
95-
<goal>build</goal>
96-
</goals>
97-
</execution>
98-
</executions>
99-
<configuration>
100-
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
101-
<baseImage>openjdk:8-alpine</baseImage>
102-
<!-- @formatter: off-->
103-
<entryPoint>["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/${project.build.finalName}.jar"]
104-
</entryPoint>
105-
<!-- @formatter: on-->
106-
<resources>
107-
<resource>
108-
<targetPath>/</targetPath>
109-
<directory>${project.build.directory}</directory>
110-
<include>${project.build.finalName}.jar</include>
111-
</resource>
112-
</resources>
113-
</configuration>
87+
<configuration>
88+
<image>
89+
<name>barrycommins/${project.artifactId}</name>
90+
</image>
91+
</configuration>
11492
</plugin>
11593
</plugins>
11694
</build>

0 commit comments

Comments
 (0)