Adicionado Fluentd
parent
3fd86f1952
commit
c80d7d3c1c
|
@ -27,3 +27,8 @@ docker run -d -p 5000:5000 --restart=always --name registry -v //c/registry/auth
|
||||||
```
|
```
|
||||||
docker run --restart always -p 8055:8080 -d -v "//c/bpers/log:/opt/jboss/wildfly/standalone/log" -v "//c/bpers/data:/opt/jboss/wildfly/standalone/data" -v "//c/bpers/configuration:/opt/jboss/wildfly/standalone/configuration/security" --name bpers IP_SERVIDOR:5000/bpers:latest
|
docker run --restart always -p 8055:8080 -d -v "//c/bpers/log:/opt/jboss/wildfly/standalone/log" -v "//c/bpers/data:/opt/jboss/wildfly/standalone/data" -v "//c/bpers/configuration:/opt/jboss/wildfly/standalone/configuration/security" --name bpers IP_SERVIDOR:5000/bpers:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Docker-Compose
|
||||||
|
|
||||||
|
`docker-compose up`
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
version: "3.2"
|
||||||
|
services:
|
||||||
|
agreggrator:
|
||||||
|
build: ./fluentd
|
||||||
|
ports:
|
||||||
|
- "24224:24224"
|
||||||
|
- "24224:24224/udp"
|
||||||
|
volumes:
|
||||||
|
- ./fluentd/fluent.conf:/fluentd/etc/fluent.conf
|
||||||
|
- //x/volumes/bpers/data:/dados/
|
||||||
|
elasticsearch:
|
||||||
|
image: docker.elastic.co/elasticsearch/elasticsearch:7.3.2
|
||||||
|
environment:
|
||||||
|
- discovery.type=single-node
|
||||||
|
- bootstrap.memory_lock=true
|
||||||
|
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
|
||||||
|
user: 'elasticsearch'
|
||||||
|
volumes:
|
||||||
|
- elasticsearch-data:/usr/share/elasticsearch/data
|
||||||
|
ulimits:
|
||||||
|
memlock:
|
||||||
|
soft: -1
|
||||||
|
hard: -1
|
||||||
|
nofile:
|
||||||
|
soft: 65536
|
||||||
|
hard: 65536
|
||||||
|
ports:
|
||||||
|
- "9200:9200"
|
||||||
|
kibana:
|
||||||
|
image: docker.elastic.co/kibana/kibana:7.3.2
|
||||||
|
links:
|
||||||
|
- elasticsearch
|
||||||
|
ports:
|
||||||
|
- "5601:5601"
|
||||||
|
environment:
|
||||||
|
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
|
||||||
|
depends_on:
|
||||||
|
- elasticsearch
|
||||||
|
bpers:
|
||||||
|
image: localhost:5000/bpers:255
|
||||||
|
ports:
|
||||||
|
- 8055:8080
|
||||||
|
volumes:
|
||||||
|
- //x/volumes/bpers/log:/opt/jboss/wildfly/standalone/log
|
||||||
|
- //x/volumes/bpers/data:/opt/jboss/wildfly/standalone/data
|
||||||
|
- //x/volumes/bpers/configuration:/opt/jboss/wildfly/standalone/configuration/security
|
||||||
|
restart: on-failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
elasticsearch-data:
|
|
@ -0,0 +1,18 @@
|
||||||
|
FROM fluent/fluentd:v1.5-1
|
||||||
|
|
||||||
|
# Use root account to use apk
|
||||||
|
USER root
|
||||||
|
|
||||||
|
RUN apk add --no-cache --update geoip-dev \
|
||||||
|
&& apk add --no-cache --update --virtual .build-deps build-base ruby-dev \
|
||||||
|
&& echo 'gem: --no-document' >> /etc/gemrc \
|
||||||
|
&& gem install fluent-plugin-elasticsearch fluent-plugin-woothee fluent-plugin-ua-parser fluent-plugin-geoip-filter fluent-plugin-multi-format-parser \
|
||||||
|
&& gem sources --clear-all \
|
||||||
|
&& apk del .build-deps \
|
||||||
|
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
|
||||||
|
|
||||||
|
COPY fluent.conf /fluentd/etc/
|
||||||
|
COPY entrypoint.sh /bin/
|
||||||
|
|
||||||
|
ENV FLUENT_UID=0
|
||||||
|
#USER fluent
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#source vars if file exists
|
||||||
|
DEFAULT=/etc/default/fluentd
|
||||||
|
|
||||||
|
if [ -r $DEFAULT ]; then
|
||||||
|
set -o allexport
|
||||||
|
. $DEFAULT
|
||||||
|
set +o allexport
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the user has supplied only arguments append them to `fluentd` command
|
||||||
|
if [ "${1#-}" != "$1" ]; then
|
||||||
|
set -- fluentd "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If user does not supply config file or plugins, use the default
|
||||||
|
if [ "$1" = "fluentd" ]; then
|
||||||
|
if ! echo $@ | grep ' \-c' ; then
|
||||||
|
set -- "$@" -c /fluentd/etc/${FLUENTD_CONF}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! echo $@ | grep ' \-p' ; then
|
||||||
|
set -- "$@" -p /fluentd/plugins
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
|
@ -0,0 +1,46 @@
|
||||||
|
<source>
|
||||||
|
@type forward
|
||||||
|
port 24224
|
||||||
|
bind 0.0.0.0
|
||||||
|
tag bpe
|
||||||
|
</source>
|
||||||
|
|
||||||
|
<filter *.**>
|
||||||
|
@type parser
|
||||||
|
format /^(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) (?<log_level>\w+) \[(?<class>.*)\] \((?<pid>.*)\) (?<message>.*)/
|
||||||
|
key_name message
|
||||||
|
time_format %Y-%m-%d %H:%M:%S,%L
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<match *.**>
|
||||||
|
@type copy
|
||||||
|
<store>
|
||||||
|
@type elasticsearch
|
||||||
|
host elasticsearch
|
||||||
|
port 9200
|
||||||
|
logstash_format true
|
||||||
|
logstash_prefix bpe
|
||||||
|
logstash_dateformat %Y%m%d
|
||||||
|
include_tag_key true
|
||||||
|
tag_key @log_name
|
||||||
|
flush_interval 1s
|
||||||
|
|
||||||
|
<buffer tag>
|
||||||
|
#@type memory # file #or memory
|
||||||
|
@type file
|
||||||
|
path /tmp/fluentd*.buffer
|
||||||
|
flush_mode interval
|
||||||
|
retry_type exponential_backoff
|
||||||
|
flush_thread_count 4
|
||||||
|
flush_interval 1s
|
||||||
|
retry_forever
|
||||||
|
retry_max_interval 30
|
||||||
|
chunk_limit_size 2M
|
||||||
|
queue_limit_length 8
|
||||||
|
overflow_action block
|
||||||
|
</buffer>
|
||||||
|
</store>
|
||||||
|
<store>
|
||||||
|
@type stdout
|
||||||
|
</store>
|
||||||
|
</match>
|
Loading…
Reference in New Issue