commit dad8a7ff4cd81c6c0dc47aaeeec39dbaa30f9aa3 Author: Aleksander Cynarski Date: Thu Sep 3 16:05:06 2020 +0200 initial commit diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..ee65f89 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,35 @@ +kind: pipeline +name: default + +steps: +- name: docker + image: plugins/docker + settings: + username: + from_secret: hub_username + password: + from_secret: hub_password + repo: + from_secret: hub_repo + tags: latest + when: + branch: + - master + +- name: notify + image: appleboy/drone-telegram + settings: + token: + from_secret: telegram_bot_token + to: + from_secret: telegram_group_id + message: > + {{#success build.status}} + build {{build.link}} triggerd by {{commit.link}} from {{commit.author}} succeeded + {{else}} + build {{build.link}} triggerd by {{commit.link}} from {{commit.author}} failed + {{/success}} + when: + status: + - success + - failure diff --git a/DOCKER_DEPLOY.md b/DOCKER_DEPLOY.md new file mode 100644 index 0000000..e911770 --- /dev/null +++ b/DOCKER_DEPLOY.md @@ -0,0 +1,19 @@ +# Drone docker deploy + +## Użycie + +``` +cat ${args[0]} |awk -F\= '{system("drone secret add --repository='${args[1]}' --name="$1 " --data="$2)}' +``` + +Wymagane zmienne: + +``` +hub_username= +hub_password= +hub_repo= +telegram_bot_token= +telegram_group_id= +``` + + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dfdc32b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,56 @@ +FROM debian:stretch-slim as builder + +# Fluent Bit version +ENV FLB_MAJOR 1 +ENV FLB_MINOR 5 +ENV FLB_PATCH 4 +ENV FLB_VERSION 1.5.4 + +ARG FLB_TARBALL=https://github.com/fluent/fluent-bit/archive/v$FLB_VERSION.tar.gz +ENV FLB_SOURCE $FLB_TARBALL +RUN mkdir -p /fluent-bit/bin /fluent-bit/etc /fluent-bit/log /tmp/fluent-bit-master/ + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && \ + apt-get install -y curl \ + ca-certificates build-essential \ + cmake make bash sudo wget unzip dh-make \ + libsystemd-dev zlib1g-dev flex bison \ + libssl1.1 libssl-dev libpq-dev postgresql-server-dev-all && \ + apt-get install -y --reinstall lsb-base lsb-release \ + && curl -L -o "/tmp/fluent-bit.tar.gz" ${FLB_SOURCE} \ + && cd tmp/ && mkdir fluent-bit \ + && tar zxfv fluent-bit.tar.gz -C ./fluent-bit --strip-components=1 \ + && cd fluent-bit/build/ \ + && rm -rf /tmp/fluent-bit/build/* + +WORKDIR /tmp/fluent-bit/build/ +RUN cmake -DFLB_DEBUG=On \ + -DFLB_TRACE=Off \ + -DFLB_JEMALLOC=On \ + -DFLB_TLS=On \ + -DFLB_SHARED_LIB=Off \ + -DFLB_EXAMPLES=Off \ + -DFLB_HTTP_SERVER=On \ + -DFLB_IN_SYSTEMD=On \ + -DFLB_OUT_KAFKA=On \ + -DFLB_OUT_PGSQL=On .. + +RUN make -j $(getconf _NPROCESSORS_ONLN) +RUN install bin/fluent-bit /fluent-bit/bin/ + +# Configuration files +COPY conf/fluent-bit.conf \ + conf/parsers.conf \ + conf/parsers_ambassador.conf \ + conf/parsers_java.conf \ + conf/parsers_extra.conf \ + conf/parsers_openstack.conf \ + conf/parsers_cinder.conf \ + conf/plugins.conf \ + /fluent-bit/etc/ + +FROM gcr.io/distroless/cc + +COPY --from=builder /fluent-bit /fluent-bit diff --git a/conf/fluent-bit.conf b/conf/fluent-bit.conf new file mode 100644 index 0000000..00aff07 --- /dev/null +++ b/conf/fluent-bit.conf @@ -0,0 +1,48 @@ +[SERVICE] + # Flush + # ===== + # Set an interval of seconds before to flush records to a destination + Flush 5 + + # Daemon + # ====== + # Instruct Fluent Bit to run in foreground or background mode. + Daemon Off + + # Log_Level + # ========= + # Set the verbosity level of the service, values can be: + # + # - error + # - warning + # - info + # - debug + # - trace + # + # By default 'info' is set, that means it includes 'error' and 'warning'. + Log_Level info + + # Parsers_File + # ============ + # Specify an optional 'Parsers' configuration file + Parsers_File parsers.conf + Plugins_File plugins.conf + + # HTTP Server + # =========== + # Enable/Disable the built-in HTTP Server for metrics + HTTP_Server Off + HTTP_Listen 0.0.0.0 + HTTP_Port 2020 + +[INPUT] + Name cpu + Tag cpu.local + # Interval Sec + # ==== + # Read interval (sec) Default: 1 + Interval_Sec 1 + +[OUTPUT] + Name stdout + Match * diff --git a/conf/parsers.conf b/conf/parsers.conf new file mode 100644 index 0000000..5cb4335 --- /dev/null +++ b/conf/parsers.conf @@ -0,0 +1,117 @@ +[PARSER] + Name apache + Format regex + Regex ^(?[^ ]*) [^ ]* (?[^ ]*) \[(?