Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1402 로그 모니터링 시스템 구축 #1410

Merged
merged 4 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.