Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.

Commit 233e1ba

Browse files
committed
corrected bug for fluentd logging
1 parent ddc5ae6 commit 233e1ba

File tree

6 files changed

+87
-4
lines changed

6 files changed

+87
-4
lines changed

sandbox/docker-compose.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: '2'
2+
services:
3+
eureka:
4+
image: dinutac/netflixoss-eureka:latest
5+
expose:
6+
- "8080"
7+
ports:
8+
- "8080:8080"
9+
10+
estuary-discovery:
11+
hostname: estuary-discovery
12+
image: dinutac/estuary-discovery:latest
13+
command: bash -c "sleep 25 && /scripts/main_flask.py"
14+
environment:
15+
FLUENTD_IP_PORT: fluentd:24224
16+
EUREKA_SERVER: http://eureka:8080/eureka/v2
17+
APP_IP_PORT: 192.168.0.11:8081
18+
expose:
19+
- "8080"
20+
ports:
21+
- "8081:8080"
22+
23+
24+
estuary-agent-java:
25+
hostname: estuary-agent-java
26+
image: dinutac/estuary-agent-java:latest
27+
entrypoint: bash -c "sleep 30 && java -jar /app/agent-exec.jar --eureka.client.enabled=true"
28+
environment:
29+
spring_profiles_active: test
30+
FLUENTD_IP_PORT: fluentd:24224
31+
EUREKA_SERVER: http://eureka:8080/eureka/v2
32+
APP_IP: 192.168.0.11
33+
PORT: 8082 # <--
34+
HTTP_AUTH_TOKEN: None
35+
ports:
36+
- "8082:8082"
37+
38+
fluentd:
39+
build: ./fluentd
40+
volumes:
41+
- ./fluentd/conf:/fluentd/etc
42+
ports:
43+
- "24224:24224"
44+
- "24224:24224/udp"

sandbox/fluentd/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM fluentd:v1.9.1-debian-1.0
2+
USER root
3+
4+
RUN ["fluent-gem", "install", "fluent-plugin-elasticsearch", "--no-document", "--version", "4.1.1"]
5+
RUN ["fluent-gem", "install", "fluent-plugin-gelf"]
6+
7+
USER fluent

sandbox/fluentd/conf/fluent.conf

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<source>
2+
@type forward
3+
port 24224
4+
bind 0.0.0.0
5+
</source>
6+
7+
<match *.**>
8+
@type stdout
9+
</match>
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<source>
2+
@type forward
3+
port 24224
4+
bind 0.0.0.0
5+
</source>
6+
7+
<match *.**>
8+
@type gelf
9+
host graylog
10+
port 12201
11+
<buffer>
12+
flush_interval 1s
13+
</buffer>
14+
</match>

src/main/java/com/github/dinuta/estuary/agent/configuration/BeanConfig.java

+10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package com.github.dinuta.estuary.agent.configuration;
22

3+
import com.github.dinuta.estuary.agent.component.About;
34
import com.github.dinuta.estuary.agent.model.StateHolder;
45
import com.github.dinuta.estuary.agent.model.api.CommandParallel;
6+
import com.github.dinuta.estuary.agent.service.FluentdService;
7+
import org.springframework.beans.factory.annotation.Autowired;
58
import org.springframework.context.annotation.Bean;
69
import org.springframework.context.annotation.Configuration;
710

811
@Configuration
912
public class BeanConfig {
13+
@Autowired
14+
private About about;
1015

1116
@Bean
1217
public CommandParallel getCommandParallel() {
@@ -17,4 +22,9 @@ public CommandParallel getCommandParallel() {
1722
public StateHolder getStateHolder() {
1823
return new StateHolder();
1924
}
25+
26+
@Bean
27+
public FluentdService getFluentdService() {
28+
return new FluentdService(about);
29+
}
2030
}

src/main/java/com/github/dinuta/estuary/agent/service/FluentdService.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ public class FluentdService {
2727
private static final Logger log = LoggerFactory.getLogger(FluentdService.class);
2828
private final VirtualEnvironment virtualEnvironment = new VirtualEnvironment();
2929
private FluentLogger fluentLogger;
30+
private About about;
3031
private EnrichedMessage enrichedMsgCopy;
3132

3233
@Autowired
3334
private Environment environment;
3435

35-
@Autowired
36-
private About about;
37-
38-
public FluentdService() {
36+
public FluentdService(About about) {
37+
this.about = about;
3938
this.setFluentdLogger();
4039
}
4140

0 commit comments

Comments
 (0)