diff --git a/backend/build.gradle b/backend/build.gradle index 6c9353372bab2..0eaa28486e413 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -24,6 +24,12 @@ dependencies { // compile "io.springfox:springfox-swagger2:2.8.0" // compile "javax.xml.bind:jaxb-api:2.3.0" + compile "net.logstash.logback:logstash-logback-encoder:4.11" + compile "ch.qos.logback:logback-classic:$logbackVersion" + compile "ch.qos.logback:logback-core:$logbackVersion" + compile "ch.qos.logback:logback-access:$logbackVersion" + compile "org.slf4j:slf4j-api:$slf4jVersion" + compile "com.google.protobuf:protobuf-java-util:$protocVersion" compile "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion" diff --git a/backend/src/main/java/castro/backend/Application.java b/backend/src/main/java/castro/backend/Application.java index a5777c5752ba6..1f86fa8fc9c60 100644 --- a/backend/src/main/java/castro/backend/Application.java +++ b/backend/src/main/java/castro/backend/Application.java @@ -1,5 +1,7 @@ package castro.backend; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -19,7 +21,10 @@ @SpringBootApplication //@EnableSwagger2 public class Application { + private static final Logger logger = LoggerFactory.getLogger(Application.class); + public static void main(String[] args) { + logger.debug("Hello, Castro."); SpringApplication.run(Application.class, args); } diff --git a/backend/src/main/java/castro/backend/controllers/RepositoryApiController.java b/backend/src/main/java/castro/backend/controllers/RepositoryApiController.java index e08e1ced6e771..d87912cf28879 100644 --- a/backend/src/main/java/castro/backend/controllers/RepositoryApiController.java +++ b/backend/src/main/java/castro/backend/controllers/RepositoryApiController.java @@ -13,6 +13,7 @@ public class RepositoryApiController implements RepositoryApi { @Override public Repository repositoryImpl(String id) { + logger.debug("Repository {}", id); return Repository.newBuilder().setDomain("github.com").setMainBranch("master").setRepositoryId(id).build(); } diff --git a/backend/src/main/resources/logback.xml b/backend/src/main/resources/logback.xml new file mode 100644 index 0000000000000..f6a08d6456c3c --- /dev/null +++ b/backend/src/main/resources/logback.xml @@ -0,0 +1,23 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n + + + + + 127.0.0.1:5000 + + + + + + + + + + + \ No newline at end of file diff --git a/config/logstash/config/logstash.yml b/config/logstash/config/logstash.yml new file mode 100644 index 0000000000000..0e7f4edea0322 --- /dev/null +++ b/config/logstash/config/logstash.yml @@ -0,0 +1,2 @@ +node: + name: "dev" \ No newline at end of file diff --git a/config/logstash/pipeline/logstash.conf b/config/logstash/pipeline/logstash.conf new file mode 100644 index 0000000000000..f1f3f67294f1d --- /dev/null +++ b/config/logstash/pipeline/logstash.conf @@ -0,0 +1,15 @@ +input { + tcp { + port => 5000 + codec => "json" + } +} + +output { + elasticsearch { + hosts => [ "elasticsearch:9200" ] + } + stdout { + codec => json + } +} \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 1a0cfe7b0e4a1..c7866a2c48a55 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,4 +9,17 @@ services: # - 9300:9300 // when using tcp port environment: ES_JAVA_OPTS: "-Xms768m -Xmx768m" + restart: on-failure + + logstash: + image: 'elastic/logstash:6.3.0' + volumes: + - ./config/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml + - ./config/logstash/pipeline/:/usr/share/logstash/pipeline/ + ports: + - "5000:5000" + environment: + LS_JAVA_OPTS: "-Xmx256m -Xms256m" + depends_on: + - elasticsearch restart: on-failure \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index d823f649be501..489ca98b09cb1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,6 @@ yarnVersion = 1.6.0 protocVersion = 3.5.1 jgitVersion = 5.0.0.201805301535-rc2 + +slf4jVersion = 1.7.25 +logbackVersion = 1.2.3