-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1410 from woowacourse/feature/1402-로그_모니터링_시스템_구축
Feature/1402 로그 모니터링 시스템 구축
- Loading branch information
Showing
4 changed files
with
48 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 &" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.