Skip to content

Commit

Permalink
#41 Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
spuliaiev-sfdc committed Aug 6, 2018
1 parent bd3c321 commit 3857d3c
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
4 changes: 4 additions & 0 deletions elk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM sebp/elk

# overwrite existing file
ADD logback.conf /etc/logstash/conf.d/01-gallerymine.conf
1 change: 1 addition & 0 deletions elk/enter_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
16 changes: 16 additions & 0 deletions elk/logback.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
input {
file {
path => "/mnt/app-logs/*.log"
codec => "json"
type => "logback"
}
}

output {
if [type]=="logback" {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "logback-%{+YYYY.MM.dd}"
}
}
}
8 changes: 8 additions & 0 deletions elk/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo "From https://elk-docker.readthedocs.io/"
echo "http://www.baeldung.com/java-application-logs-to-elastic-stack"
echo "Kibana local: http://localhost:5601/app/kibana#/home/tutorial_directory/logging?_g=()"
sudo docker pull sebp/elk
export MAX_MAP_COUNT=262144
#sudo docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk sebp/elk
docker build . -t elkgallerymine
sudo docker-compose up elk
5 changes: 5 additions & 0 deletions elk/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# MAX_MAP_COUNT = 262144
export MAX_MAP_COUNT = 262144
sudo docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk sebp/elk
sudo docker start elk
6 changes: 6 additions & 0 deletions ui/web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@
<version>${cucumber.java.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.11</version>
</dependency>
</dependencies>

<build>
Expand Down
10 changes: 10 additions & 0 deletions ui/web/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,17 @@
<logger name="org.springframework.core.env.PropertySourcesPropertyResolver" level="WARN" additivity="true" />
<logger name="org.springframework.beans.factory.support.DefaultListableBeanFactory" level="WARN" additivity="true" />

<appender name="STASH" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/galleryMine.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/galleryMine.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>

<root level="INFO">
<appender-ref ref="STASH" />
<!--<appender-ref ref="stdout"/>-->
<!--<appender-ref ref="INDEX_FILE"/>-->
</root>
Expand Down

0 comments on commit 3857d3c

Please sign in to comment.