Skip to content

Commit

Permalink
Merge pull request #1410 from woowacourse/feature/1402-로그_모니터링_시스템_구축
Browse files Browse the repository at this point in the history
Feature/1402 로그 모니터링 시스템 구축
  • Loading branch information
java-saeng authored Jul 14, 2023
2 parents 55141e0 + d4ece96 commit 20e24d2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 57 deletions.
1 change: 0 additions & 1 deletion .github/workflows/back-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp -r .ebextensions deploy/.ebextensions
cp -r deploy-config deploy
cd deploy && zip -r deploy.zip .
- name: Deploy to EB
Expand Down
48 changes: 48 additions & 0 deletions backend/.ebextensions/02-set-filebeat.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
files:
"/tmp/make_filebeat_yml.sh":
mode: "000755"
content: |
#!/bin/bash
PASSWORD=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k ELASTICSEARCH_PASSWORD)
HOST=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k ELASTICSEARCH_HOST)
PORT=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k ELASTICSEARCH_PORT)
USER=$(sudo /opt/elasticbeanstalk/bin/get-config environment -k ELASTICSEARCH_USER)
cat > /home/ec2-user/filebeat-7.14.1-linux-x86_64/filebeat.yml <<EOF
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/app/current/logs/info/info.log
- /var/app/current/logs/error/error.log
- /var/app/current/logs/warn/*.log
fields:
log_type: legacy-log
- type: log
enabled: true
paths:
- /var/log/nginx/access.log
fields:
log_type: access-log

output.elasticsearch:
hosts: ["$HOST:$PORT"]
username: "$USER"
password: "$PASSWORD"
indices:
- index: "filebeat-%{[agent.version]}-access-log"
when.equals:
fields.log_type: "access-log"
- index: "filebeat-%{[agent.version]}-legacy-log"
when.equals:
fields.log_type: "legacy-log"
EOF

commands:
01_install_filebeat:
command: |
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.14.1-linux-x86_64.tar.gz
tar xzvf filebeat-7.14.1-linux-x86_64.tar.gz
02_run_make_filebeat_yml_script:
command: "bash /tmp/make_filebeat_yml.sh"
03_run_filebeat_yml:
command: "nohup /home/ec2-user/filebeat-7.14.1-linux-x86_64/filebeat -e &"
10 changes: 0 additions & 10 deletions backend/.ebextensions/02-set-promtail.config

This file was deleted.

46 changes: 0 additions & 46 deletions backend/deploy-config/promtail-local-config.yaml

This file was deleted.

0 comments on commit 20e24d2

Please sign in to comment.