From 05109681735e43d6f7be7169dfa3d358be580681 Mon Sep 17 00:00:00 2001 From: pasindu Date: Mon, 27 May 2024 17:53:18 +0530 Subject: [PATCH 1/4] Remove jq usage --- Dockerfile | 3 --- entrypoint.sh | 57 ++++++++++++++++++++++++--------------------------- 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index ee195c6..ba86611 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,6 @@ FROM docker.elastic.co/beats/filebeat:8.2.0 # Switch to root user USER root -#install jq to the container -RUN apt-get update && apt-get install -y jq - COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index a13a7ae..d859a04 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,35 +1,32 @@ #!/bin/bash -set -e - -# Path to the ECS metadata file -METADATA_FILE=$(cat "$ECS_CONTAINER_METADATA_FILE") - -if [ -f "$METADATA_FILE" ]; then - # Extract HostPrivateIPv4Address from the metadata file - HOST_PRIVATE_IP=$(jq -r '.HostPrivateIPv4Address' < "$METADATA_FILE") - if [ "$HOST_PRIVATE_IP" != "null" ]; then - echo "Host Private IP: $HOST_PRIVATE_IP" - export HOST_PRIVATE_IP - - # Define the input template file and output file - TEMPLATE_FILE="filebeat.template.yml" - OUTPUT_FILE="filebeat.yml" - - mkdir -p /opt/filebeat-configs/${HOST_PRIVATE_IP} - - # Replace the placeholder with the actual node name and write to the output file - sed "s/{{HOST_PRIVATE_IP}}/${HOST_PRIVATE_IP}/g" "/opt/filebeat-configs/$TEMPLATE_FILE" > "/opt/filebeat-configs/${HOST_PRIVATE_IP}/$OUTPUT_FILE" - echo "Filebeat configuration file created: $OUTPUT_FILE" - - # Create symlinks - rm -rf /usr/share/filebeat/elk - ln -sf "/opt/logs/${HOST_PRIVATE_IP}/elk" /usr/share/filebeat/elk - ln -sf "/opt/filebeat-configs/${HOST_PRIVATE_IP}/filebeat.yml" /usr/share/filebeat/filebeat.yml - else - echo "HostPrivateIPv4Address not found in metadata file" - fi + +# Check if ECS_CONTAINER_METADATA_FILE is set +if [ -z "$ECS_CONTAINER_METADATA_FILE" ]; then + echo "ECS_CONTAINER_METADATA_FILE is not set or the server is running on local deployment environment" +fi + +# Extract HostPrivateIPv4Address from the metadata file +HOST_PRIVATE_IP=$(cat $ECS_CONTAINER_METADATA_FILE | grep -oP '(?<=HostPrivateIPv4Address": ")[^"]+') + +if [ "$HOST_PRIVATE_IP" != "null" ]; then + echo "Host Private IP: $HOST_PRIVATE_IP" + + # Define the input template file and output file + TEMPLATE_FILE="filebeat.template.yml" + OUTPUT_FILE="filebeat.yml" + + mkdir -p /opt/filebeat-configs/${HOST_PRIVATE_IP} + + # Replace the placeholder with the actual node name and write to the output file + sed "s/{{HOST_PRIVATE_IP}}/${HOST_PRIVATE_IP}/g" "/opt/filebeat-configs/$TEMPLATE_FILE" > "/opt/filebeat-configs/${HOST_PRIVATE_IP}/$OUTPUT_FILE" + echo "Filebeat configuration file created: $OUTPUT_FILE" + + # Create symlinks + rm -rf /usr/share/filebeat/elk + ln -sf "/opt/logs/${HOST_PRIVATE_IP}/elk" /usr/share/filebeat/elk + ln -sf "/opt/filebeat-configs/${HOST_PRIVATE_IP}/filebeat.yml" /usr/share/filebeat/filebeat.yml else - echo "Metadata file does not exist" + echo "HostPrivateIPv4Address not found" fi # Run the original filebeat entrypoint -- 2.36.3 From aee6ab81a250211c0d2f5f52d1a11903764d241e Mon Sep 17 00:00:00 2001 From: pasindu Date: Wed, 3 Jul 2024 14:00:51 +0530 Subject: [PATCH 2/4] Fix issues in custom filebeat image --- Dockerfile | 6 +++++- docker-compose.yml | 17 +++++++++++++++++ entrypoint.sh | 10 +++++++--- .../filebeat-configs/filebeat.template.yml | 19 +++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 docker-compose.yml create mode 100644 files/filebeat/opt/filebeat-configs/filebeat.template.yml diff --git a/Dockerfile b/Dockerfile index ba86611..e63f579 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,8 @@ USER root COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +# Set the entry point to your custom script using tini +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/entrypoint.sh"] + +# Set the CMD to pass the environment argument to Filebeat +CMD ["-environment", "container"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..50804ec --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: "3.8" + +services: + entgra-filebeat: + image: filebeat:8.2.0-entgra-v2 + container_name: entgra-filebeat + restart: unless-stopped + extra_hosts: + - "host.docker.internal:host-gateway" + volumes: + - ./files/iots/logs/:/opt/logs + - ./files/filebeat/opt/filebeat-configs:/opt/filebeat-configs + command: ["--strict.perms=false"] + environment: + - TZ=Asia/Colombo + - LOGSTASH_HOST=logstash + - LOGSTASH_PORT=5044 \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index d859a04..ab0bc69 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,9 +16,13 @@ if [ "$HOST_PRIVATE_IP" != "null" ]; then OUTPUT_FILE="filebeat.yml" mkdir -p /opt/filebeat-configs/${HOST_PRIVATE_IP} + cp /opt/filebeat-configs/$TEMPLATE_FILE /opt/filebeat-configs/${HOST_PRIVATE_IP}/$OUTPUT_FILE # Replace the placeholder with the actual node name and write to the output file - sed "s/{{HOST_PRIVATE_IP}}/${HOST_PRIVATE_IP}/g" "/opt/filebeat-configs/$TEMPLATE_FILE" > "/opt/filebeat-configs/${HOST_PRIVATE_IP}/$OUTPUT_FILE" + sed -i 's/${HOST_PRIVATE_IP}/'$HOST_PRIVATE_IP'/g' /opt/filebeat-configs/${HOST_PRIVATE_IP}/$OUTPUT_FILE + sed -i 's/${LOGSTASH_HOST}/'$LOGSTASH_HOST'/g' /opt/filebeat-configs/${HOST_PRIVATE_IP}/$OUTPUT_FILE + sed -i 's/${LOGSTASH_PORT}/'$LOGSTASH_PORT'/g' /opt/filebeat-configs/${HOST_PRIVATE_IP}/$OUTPUT_FILE + echo "Filebeat configuration file created: $OUTPUT_FILE" # Create symlinks @@ -29,5 +33,5 @@ else echo "HostPrivateIPv4Address not found" fi -# Run the original filebeat entrypoint -exec /usr/bin/tini -- /usr/local/bin/docker-entrypoint "$@" +# Execute the original Filebeat entry point with passed arguments +exec /usr/local/bin/docker-entrypoint "$@" \ No newline at end of file diff --git a/files/filebeat/opt/filebeat-configs/filebeat.template.yml b/files/filebeat/opt/filebeat-configs/filebeat.template.yml new file mode 100644 index 0000000..b429c54 --- /dev/null +++ b/files/filebeat/opt/filebeat-configs/filebeat.template.yml @@ -0,0 +1,19 @@ +filebeat.inputs: + - type: log + enabled: true + tags: ["SwitchGearLogs"] + paths: + - /usr/share/filebeat/elk/switchgear.log + exclude_files: [".gz$"] + exclude_lines: ["^.*TRACE.*$"] + +output.logstash: + hosts: ["${LOGSTASH_HOST}:${LOGSTASH_PORT}"] + +processors: + - add_docker_metadata: + host: "unix:///host_docker/docker.sock" + - add_fields: + target: "" + fields: + node.name: "${HOST_PRIVATE_IP}" #custom node name -- 2.36.3 From 69e411f70a889a1efecb1efafd3f84b615b7867d Mon Sep 17 00:00:00 2001 From: pasindu Date: Thu, 11 Jul 2024 06:22:52 +0530 Subject: [PATCH 3/4] Add elk stack image build instructions --- README.md | 11 +----- entgra-elasticsearch/Dockerfile | 5 +++ entgra-elasticsearch/README.md | 12 ++++++ entgra-elasticsearch/docker-compose.yml | 26 +++++++++++++ entgra-elasticsearch/elasticsearch.yml | 8 ++++ Dockerfile => entgra-filebeat/Dockerfile | 0 entgra-filebeat/README.md | 12 ++++++ .../docker-compose.yml | 2 +- .../entrypoint.sh | 0 .../files/filebeat}/filebeat.template.yml | 0 entgra-kibana/Dockerfile | 3 ++ entgra-kibana/README.md | 12 ++++++ entgra-kibana/kibana.yml | 15 +++++++ entgra-logstash/Dockerfile | 3 ++ entgra-logstash/README.md | 12 ++++++ entgra-logstash/logstash.conf | 39 +++++++++++++++++++ 16 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 entgra-elasticsearch/Dockerfile create mode 100644 entgra-elasticsearch/README.md create mode 100644 entgra-elasticsearch/docker-compose.yml create mode 100644 entgra-elasticsearch/elasticsearch.yml rename Dockerfile => entgra-filebeat/Dockerfile (100%) create mode 100644 entgra-filebeat/README.md rename docker-compose.yml => entgra-filebeat/docker-compose.yml (79%) rename entrypoint.sh => entgra-filebeat/entrypoint.sh (100%) rename {files/filebeat/opt/filebeat-configs => entgra-filebeat/files/filebeat}/filebeat.template.yml (100%) create mode 100644 entgra-kibana/Dockerfile create mode 100644 entgra-kibana/README.md create mode 100644 entgra-kibana/kibana.yml create mode 100644 entgra-logstash/Dockerfile create mode 100644 entgra-logstash/README.md create mode 100644 entgra-logstash/logstash.conf diff --git a/README.md b/README.md index bb953b3..121a767 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,3 @@ ## Instructions -1. Pull the filebeat image -```bash -docker pull docker.elastic.co/beats/filebeat:8.2.0 -``` -Note: Change the filebeat image name or tag in Dockerfile related to the pulled version. - -3. Build the Docker image -```bash -docker build -t filebeat:8.2.0-entgra-v1 . -``` +Note: cd to the exact directory and build the images. diff --git a/entgra-elasticsearch/Dockerfile b/entgra-elasticsearch/Dockerfile new file mode 100644 index 0000000..0be8d4f --- /dev/null +++ b/entgra-elasticsearch/Dockerfile @@ -0,0 +1,5 @@ +FROM docker.elastic.co/elasticsearch/elasticsearch:8.2.0 + +RUN rm -Rf /usr/share/elasticsearch/config/elasticsearch.yml + +COPY elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml \ No newline at end of file diff --git a/entgra-elasticsearch/README.md b/entgra-elasticsearch/README.md new file mode 100644 index 0000000..c219b13 --- /dev/null +++ b/entgra-elasticsearch/README.md @@ -0,0 +1,12 @@ +## Instructions + +1. Pull the elasticsearch image +```bash +docker pull docker.elastic.co/elasticsearch/elasticsearch:8.2.0 +``` +Note: Change the required image version name or tag in the Dockerfile. + +3. Build the Docker image +```bash +docker build -t elasticsearch:8.2.0-entgra-v1 . +``` diff --git a/entgra-elasticsearch/docker-compose.yml b/entgra-elasticsearch/docker-compose.yml new file mode 100644 index 0000000..923873d --- /dev/null +++ b/entgra-elasticsearch/docker-compose.yml @@ -0,0 +1,26 @@ +version: "3.8" + +services: + elasticsearch: + image: elasticsearch:8.2.0-entgra-v2 + container_name: elasticsearch + restart: unless-stopped + environment: + - TZ=Asia/Colombo + - discovery.type=single-node + - xpack.security.enabled=false + - bootstrap.memory_lock=true + - "ES_JAVA_OPTS=-Xms1g -Xmx1g" + volumes: + - ./files/data:/usr/share/elasticsearch/data + - ./files/backup:/usr/share/elasticsearch/backup +# - ./files/configs:/usr/share/elasticsearch/config + - ./files/logs:/usr/share/elasticsearch/logs + ports: + - "9200:9200" + healthcheck: + test: curl --fail http://localhost:9200/ || exit 1 + interval: 60s + retries: 10 + start_period: 30s + timeout: 10s \ No newline at end of file diff --git a/entgra-elasticsearch/elasticsearch.yml b/entgra-elasticsearch/elasticsearch.yml new file mode 100644 index 0000000..c660745 --- /dev/null +++ b/entgra-elasticsearch/elasticsearch.yml @@ -0,0 +1,8 @@ +cluster.name: "docker-cluster" +network.host: 0.0.0.0 + +# minimum_master_nodes need to be explicitly set when bound on a public IP +# # set to 1 to allow single node clusters +# # Details: https://github.com/elastic/elasticsearch/pull/17288 +# discovery.zen.minimum_master_nodes: 1 +path.repo: ["/usr/share/elasticsearch/backup"] diff --git a/Dockerfile b/entgra-filebeat/Dockerfile similarity index 100% rename from Dockerfile rename to entgra-filebeat/Dockerfile diff --git a/entgra-filebeat/README.md b/entgra-filebeat/README.md new file mode 100644 index 0000000..9b5c4c6 --- /dev/null +++ b/entgra-filebeat/README.md @@ -0,0 +1,12 @@ +## Instructions + +1. Pull the filebeat image +```bash +docker pull docker.elastic.co/beats/filebeat:8.2.0 +``` +Note: Change the required image version name or tag in the Dockerfile. + +3. Build the Docker image +```bash +docker build -t filebeat:8.2.0-entgra-v1 . +``` diff --git a/docker-compose.yml b/entgra-filebeat/docker-compose.yml similarity index 79% rename from docker-compose.yml rename to entgra-filebeat/docker-compose.yml index 50804ec..6a60339 100644 --- a/docker-compose.yml +++ b/entgra-filebeat/docker-compose.yml @@ -9,7 +9,7 @@ services: - "host.docker.internal:host-gateway" volumes: - ./files/iots/logs/:/opt/logs - - ./files/filebeat/opt/filebeat-configs:/opt/filebeat-configs + - ./files/filebeat/:/opt/filebeat-configs command: ["--strict.perms=false"] environment: - TZ=Asia/Colombo diff --git a/entrypoint.sh b/entgra-filebeat/entrypoint.sh similarity index 100% rename from entrypoint.sh rename to entgra-filebeat/entrypoint.sh diff --git a/files/filebeat/opt/filebeat-configs/filebeat.template.yml b/entgra-filebeat/files/filebeat/filebeat.template.yml similarity index 100% rename from files/filebeat/opt/filebeat-configs/filebeat.template.yml rename to entgra-filebeat/files/filebeat/filebeat.template.yml diff --git a/entgra-kibana/Dockerfile b/entgra-kibana/Dockerfile new file mode 100644 index 0000000..ccb1e4c --- /dev/null +++ b/entgra-kibana/Dockerfile @@ -0,0 +1,3 @@ +FROM docker.elastic.co/kibana/kibana:8.2.0 + +COPY kibana.yml /usr/share/kibana/kibana.yml \ No newline at end of file diff --git a/entgra-kibana/README.md b/entgra-kibana/README.md new file mode 100644 index 0000000..e9ac868 --- /dev/null +++ b/entgra-kibana/README.md @@ -0,0 +1,12 @@ +## Instructions + +1. Pull the kibana image +```bash +docker pull docker.elastic.co/kibana/kibana:8.2.0 +``` +Note: Change the required image version name or tag in the Dockerfile. + +3. Build the Docker image +```bash +docker build -t kibana:8.2.0-entgra-v1 . +``` diff --git a/entgra-kibana/kibana.yml b/entgra-kibana/kibana.yml new file mode 100644 index 0000000..2db5738 --- /dev/null +++ b/entgra-kibana/kibana.yml @@ -0,0 +1,15 @@ +security.showInsecureClusterWarning: false +monitoring.ui.container.elasticsearch.enabled: true +logging.quiet: true +logging.verbose: false + +logging: + appenders: + rolling-file: + type: rolling-file + fileName: /var/logs/kibana/kibana.log + policy: + type: size-limit + size: 10mb + layout: + type: pattern diff --git a/entgra-logstash/Dockerfile b/entgra-logstash/Dockerfile new file mode 100644 index 0000000..ba7a656 --- /dev/null +++ b/entgra-logstash/Dockerfile @@ -0,0 +1,3 @@ +FROM docker.elastic.co/logstash/logstash:8.2.0 + +COPY logstash.conf /usr/share/logstash/pipeline/logstash.conf \ No newline at end of file diff --git a/entgra-logstash/README.md b/entgra-logstash/README.md new file mode 100644 index 0000000..7e7ef5d --- /dev/null +++ b/entgra-logstash/README.md @@ -0,0 +1,12 @@ +## Instructions + +1. Pull the logstash image +```bash +docker pull docker.elastic.co/logstash/logstash:8.2.0 +``` +Note: Change the required image version name or tag in the Dockerfile. + +3. Build the Docker image +```bash +docker build -t logstash:8.2.0-entgra-v1 . +``` diff --git a/entgra-logstash/logstash.conf b/entgra-logstash/logstash.conf new file mode 100644 index 0000000..05535ff --- /dev/null +++ b/entgra-logstash/logstash.conf @@ -0,0 +1,39 @@ +input { + beats { + port => 5044 + } +} +filter { + + grok { + match => { + "message" => "\[%{GREEDYDATA:LogLevel}]\ \[%{TIMESTAMP_ISO8601:logdate}\] \[%{DATA:EventCategory}\] \[%{DATA:InitiatedBy}\] \[%{DATA:SgId}\] \[%{DATA:CbSerial}\] \[%{DATA:OcSerial}\] \[%{DATA:IpAddress}\] \[%{DATA:State}\] - %{GREEDYDATA:Description}" + } + } + + if [log][file][path] =~ "/var/log/auth.log" { + drop { } + } + if [fileset][name] =~ "syslog" { + drop { } + } + date { + match => [ "logdate", "MMM D, YYYY @ HH:mm:ss.SSS", "ISO8601"] + target => "@timestamp" + } +} +output { + + if "SwitchGearLogs" in [tags] { + elasticsearch { + hosts => ["elasticsearch:9200"] + index => "switchgearlogs-%{+YYYY.MM.dd}" + } + } + +# elasticsearch{ +# hosts => ["elasticsearch:9200"] +# index => "lecologs-%{+YYYY.MM.dd}" +# } + +} \ No newline at end of file -- 2.36.3 From 4bfb7fabd8dfe24a7dc84c317943e2dde42ac43a Mon Sep 17 00:00:00 2001 From: pasindu Date: Fri, 12 Jul 2024 15:17:27 +0530 Subject: [PATCH 4/4] Add license headers and add image build instructions --- entgra-elasticsearch/Dockerfile | 18 ++++++++++++++++- entgra-elasticsearch/README.md | 12 +++++------ entgra-elasticsearch/docker-compose.yml | 18 ++++++++++++++++- entgra-elasticsearch/elasticsearch.yml | 16 +++++++++++++++ entgra-filebeat/Dockerfile | 16 +++++++++++++++ entgra-filebeat/README.md | 13 ++++++------ entgra-filebeat/docker-compose.yml | 18 ++++++++++++++++- entgra-filebeat/entrypoint.sh | 20 +++++++++++++++++-- .../files/filebeat/filebeat.template.yml | 16 +++++++++++++++ entgra-kibana/Dockerfile | 18 ++++++++++++++++- entgra-kibana/README.md | 13 ++++++------ entgra-kibana/kibana.yml | 16 +++++++++++++++ entgra-logstash/Dockerfile | 18 ++++++++++++++++- entgra-logstash/README.md | 13 ++++++------ 14 files changed, 190 insertions(+), 35 deletions(-) diff --git a/entgra-elasticsearch/Dockerfile b/entgra-elasticsearch/Dockerfile index 0be8d4f..e6ce51e 100644 --- a/entgra-elasticsearch/Dockerfile +++ b/entgra-elasticsearch/Dockerfile @@ -1,5 +1,21 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + FROM docker.elastic.co/elasticsearch/elasticsearch:8.2.0 RUN rm -Rf /usr/share/elasticsearch/config/elasticsearch.yml -COPY elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml \ No newline at end of file +COPY elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml diff --git a/entgra-elasticsearch/README.md b/entgra-elasticsearch/README.md index c219b13..9250ac3 100644 --- a/entgra-elasticsearch/README.md +++ b/entgra-elasticsearch/README.md @@ -1,12 +1,10 @@ ## Instructions -1. Pull the elasticsearch image +1. Build the Docker image ```bash -docker pull docker.elastic.co/elasticsearch/elasticsearch:8.2.0 +docker build -t registry.entgra.io/entgra-elasticsearch:8.2.0-entgra-v2 -f Dockerfile . ``` -Note: Change the required image version name or tag in the Dockerfile. -3. Build the Docker image -```bash -docker build -t elasticsearch:8.2.0-entgra-v1 . -``` +2. docker-compose up -d +3. docker exec -it $(docker ps -aq -n 1) /bin/bash +4. docker-compose down diff --git a/entgra-elasticsearch/docker-compose.yml b/entgra-elasticsearch/docker-compose.yml index 923873d..797a575 100644 --- a/entgra-elasticsearch/docker-compose.yml +++ b/entgra-elasticsearch/docker-compose.yml @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + version: "3.8" services: @@ -23,4 +39,4 @@ services: interval: 60s retries: 10 start_period: 30s - timeout: 10s \ No newline at end of file + timeout: 10s diff --git a/entgra-elasticsearch/elasticsearch.yml b/entgra-elasticsearch/elasticsearch.yml index c660745..a3df086 100644 --- a/entgra-elasticsearch/elasticsearch.yml +++ b/entgra-elasticsearch/elasticsearch.yml @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + cluster.name: "docker-cluster" network.host: 0.0.0.0 diff --git a/entgra-filebeat/Dockerfile b/entgra-filebeat/Dockerfile index e63f579..20ec312 100644 --- a/entgra-filebeat/Dockerfile +++ b/entgra-filebeat/Dockerfile @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + FROM docker.elastic.co/beats/filebeat:8.2.0 # Switch to root user diff --git a/entgra-filebeat/README.md b/entgra-filebeat/README.md index 9b5c4c6..39d9223 100644 --- a/entgra-filebeat/README.md +++ b/entgra-filebeat/README.md @@ -1,12 +1,11 @@ ## Instructions -1. Pull the filebeat image +1. Build the Docker image ```bash -docker pull docker.elastic.co/beats/filebeat:8.2.0 +docker build -t registry.entgra.io/entgra-filebeat:8.2.0-entgra-v2 -f Dockerfile . ``` -Note: Change the required image version name or tag in the Dockerfile. -3. Build the Docker image -```bash -docker build -t filebeat:8.2.0-entgra-v1 . -``` +2. docker-compose up -d +3. docker exec -it $(docker ps -aq -n 1) /bin/bash +4. docker-compose down + diff --git a/entgra-filebeat/docker-compose.yml b/entgra-filebeat/docker-compose.yml index 6a60339..189af13 100644 --- a/entgra-filebeat/docker-compose.yml +++ b/entgra-filebeat/docker-compose.yml @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + version: "3.8" services: @@ -14,4 +30,4 @@ services: environment: - TZ=Asia/Colombo - LOGSTASH_HOST=logstash - - LOGSTASH_PORT=5044 \ No newline at end of file + - LOGSTASH_PORT=5044 diff --git a/entgra-filebeat/entrypoint.sh b/entgra-filebeat/entrypoint.sh index ab0bc69..80126c3 100644 --- a/entgra-filebeat/entrypoint.sh +++ b/entgra-filebeat/entrypoint.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + # Check if ECS_CONTAINER_METADATA_FILE is set if [ -z "$ECS_CONTAINER_METADATA_FILE" ]; then echo "ECS_CONTAINER_METADATA_FILE is not set or the server is running on local deployment environment" @@ -8,7 +24,7 @@ fi # Extract HostPrivateIPv4Address from the metadata file HOST_PRIVATE_IP=$(cat $ECS_CONTAINER_METADATA_FILE | grep -oP '(?<=HostPrivateIPv4Address": ")[^"]+') -if [ "$HOST_PRIVATE_IP" != "null" ]; then +if [ -n "$HOST_PRIVATE_IP" ]; then echo "Host Private IP: $HOST_PRIVATE_IP" # Define the input template file and output file @@ -34,4 +50,4 @@ else fi # Execute the original Filebeat entry point with passed arguments -exec /usr/local/bin/docker-entrypoint "$@" \ No newline at end of file +exec /usr/local/bin/docker-entrypoint "$@" diff --git a/entgra-filebeat/files/filebeat/filebeat.template.yml b/entgra-filebeat/files/filebeat/filebeat.template.yml index b429c54..f5f2ea5 100644 --- a/entgra-filebeat/files/filebeat/filebeat.template.yml +++ b/entgra-filebeat/files/filebeat/filebeat.template.yml @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + filebeat.inputs: - type: log enabled: true diff --git a/entgra-kibana/Dockerfile b/entgra-kibana/Dockerfile index ccb1e4c..9140c27 100644 --- a/entgra-kibana/Dockerfile +++ b/entgra-kibana/Dockerfile @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + FROM docker.elastic.co/kibana/kibana:8.2.0 -COPY kibana.yml /usr/share/kibana/kibana.yml \ No newline at end of file +COPY kibana.yml /usr/share/kibana/kibana.yml diff --git a/entgra-kibana/README.md b/entgra-kibana/README.md index e9ac868..52fba2e 100644 --- a/entgra-kibana/README.md +++ b/entgra-kibana/README.md @@ -1,12 +1,11 @@ ## Instructions -1. Pull the kibana image +1. Build the Docker image ```bash -docker pull docker.elastic.co/kibana/kibana:8.2.0 +docker build -t registry.entgra.io/entgra-kibana:8.2.0-entgra-v2 -f Dockerfile . ``` -Note: Change the required image version name or tag in the Dockerfile. -3. Build the Docker image -```bash -docker build -t kibana:8.2.0-entgra-v1 . -``` +2. docker-compose up -d +3. docker exec -it $(docker ps -aq -n 1) /bin/bash +4. docker-compose down + diff --git a/entgra-kibana/kibana.yml b/entgra-kibana/kibana.yml index 2db5738..20ad89b 100644 --- a/entgra-kibana/kibana.yml +++ b/entgra-kibana/kibana.yml @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + security.showInsecureClusterWarning: false monitoring.ui.container.elasticsearch.enabled: true logging.quiet: true diff --git a/entgra-logstash/Dockerfile b/entgra-logstash/Dockerfile index ba7a656..728caa0 100644 --- a/entgra-logstash/Dockerfile +++ b/entgra-logstash/Dockerfile @@ -1,3 +1,19 @@ +# Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +# +# Entgra (Pvt) Ltd. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + FROM docker.elastic.co/logstash/logstash:8.2.0 -COPY logstash.conf /usr/share/logstash/pipeline/logstash.conf \ No newline at end of file +COPY logstash.conf /usr/share/logstash/pipeline/logstash.conf diff --git a/entgra-logstash/README.md b/entgra-logstash/README.md index 7e7ef5d..1de98c1 100644 --- a/entgra-logstash/README.md +++ b/entgra-logstash/README.md @@ -1,12 +1,11 @@ ## Instructions -1. Pull the logstash image +1. Build the Docker image ```bash -docker pull docker.elastic.co/logstash/logstash:8.2.0 +docker build -t registry.entgra.io/entgra-logstash:8.2.0-entgra-v2 -f Dockerfile . ``` -Note: Change the required image version name or tag in the Dockerfile. -3. Build the Docker image -```bash -docker build -t logstash:8.2.0-entgra-v1 . -``` +2. docker-compose up -d +3. docker exec -it $(docker ps -aq -n 1) /bin/bash +4. docker-compose down + -- 2.36.3