1. 개요

2. 설치

2-1. awslogs-agent-setup.py 파일 다운로드

$ curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 56093  100 56093    0     0  43148      0  0:00:01  0:00:01 --:--:-- 43115

2-2. awslogs-agent-setup.py 실행

주의사항 : Python 3.5까지만 됨

ERROR: This script only supports python version 2.6 - 3.5
Step 3 of 5: Configuring AWS CLI ...
AWS Access Key ID [None]: ***
AWS Secret Access Key [None]: ***
Default region name [ap-northeast-2]:
Default output format [None]:

Step 4 of 5: Configuring the CloudWatch Logs Agent ...
Path of log file to upload [/var/log/syslog]:
Destination Log Group name [/var/log/syslog]:

Choose Log Stream name:
  1. Use EC2 instance id.
  2. Use hostname.
  3. Custom.
Enter choice [1]:

Choose Log Event timestamp format:
  1. %b %d %H:%M:%S    (Dec 31 23:59:59)
  2. %d/%b/%Y:%H:%M:%S (10/Oct/2000:13:55:36)
  3. %Y-%m-%d %H:%M:%S (2008-09-08 11:52:54)
  4. Custom
Enter choice [1]:

Choose initial position of upload:
  1. From start of file.
  2. From end of file.
Enter choice [1]:
More log files to configure? [Y]: n

Step 5 of 5: Setting up agent as a daemon ...DONE


------------------------------------------------------
- Configuration file successfully saved at: /var/awslogs/etc/awslogs.conf
- You can begin accessing new log events after a few moments at https://console.aws.amazon.com/cloudwatch/home?region=ap-northeast-2#logs:
- You can use 'sudo service awslogs start|stop|status|restart' to control the daemon.
- To see diagnostic information for the CloudWatch Logs Agent, see /var/log/awslogs.log
- You can rerun interactive setup using 'sudo python ./awslogs-agent-setup.py --region ap-northeast-2 --only-generate-config'

3. 설치 결과

$ pwd
/var/awslogs/etc
$ ls -l
total 24
-rw------- 1 root root   60 Dec  3 06:31 aws.conf
-rw------- 1 root root 8704 Dec  3 06:31 awslogs.conf
drwxr-xr-x 2 root root 4096 Dec  3 05:18 config
-rw-r--r-- 1 root root  144 Dec  3 05:18 proxy.conf