diff --git a/Makefile b/Makefile index 906e8c06a..f9e615b66 100644 --- a/Makefile +++ b/Makefile @@ -180,3 +180,6 @@ debug_external: clean build_localnet_validator: bash test/build-localnet-validator.sh + +elk: + docker-compose -f scripts/elk/docker-compose.yml up \ No newline at end of file diff --git a/scripts/elk/docker-compose.yml b/scripts/elk/docker-compose.yml new file mode 100644 index 000000000..1a3dc714d --- /dev/null +++ b/scripts/elk/docker-compose.yml @@ -0,0 +1,36 @@ +version: '3' +services: + es01-test: + image: docker.elastic.co/elasticsearch/elasticsearch:7.17.14 + container_name: es01-test + networks: + - elastic + ports: + - "127.0.0.1:9200:9200" + - "127.0.0.1:9300:9300" + environment: + - discovery.type=single-node + + kib01-test: + image: docker.elastic.co/kibana/kibana:7.17.14 + container_name: kib01-test + networks: + - elastic + ports: + - "0.0.0.0:5601:5601" + environment: + - ELASTICSEARCH_HOSTS=http://es01-test:9200 + + logstash: + image: docker.elastic.co/logstash/logstash:8.11.1 + container_name: logstash-container + networks: + - elastic + volumes: + - ./scripts/elk/logstash.conf:/usr/share/logstash/config/logstash.conf + - ./tmp_log:/tmp_log + command: logstash -f /usr/share/logstash/config/logstash.conf + +networks: + elastic: + driver: bridge diff --git a/scripts/elk/logstash.conf b/scripts/elk/logstash.conf new file mode 100644 index 000000000..41e03ee80 --- /dev/null +++ b/scripts/elk/logstash.conf @@ -0,0 +1,25 @@ +input { + file { + path => "/tmp_log/*/*.log" + start_position => "beginning" + sincedb_path => "/dev/null" + codec => "json" + } +} + +filter { + # You can add additional filters here if needed +} + +output { + stdout { + codec => rubydebug + } + + # You can send the parsed logs to other outputs like Elasticsearch + # Uncomment the lines below and modify the Elasticsearch configuration + elasticsearch { + hosts => ["es01-test:9200"] + index => "harmony" + } +}