-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathcw_logs_userdata.sh
More file actions
38 lines (32 loc) · 859 Bytes
/
cw_logs_userdata.sh
File metadata and controls
38 lines (32 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/bash
yum install git -y
yum install httpd -y
yum install awslogs -y
git clone https://github.com/ssts-alg/static_website.git
cp -r static_website/* /var/www/html/
service httpd start
chkconfig httpd on
echo '''
[plugins]
cwlogs = cwlogs
[default]
region = us-west-2
''' > /etc/awslogs/awscli.conf
echo '''
[/var/log/httpd/access_log]
datetime_format = %b %d %H:%M:%S
file = /var/log/httpd/access_log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = /var/log/httpd/access_log
[/var/log/httpd/error_log]
datetime_format = %b %d %H:%M:%S
file = /var/log/httpd/error_log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = /var/log/httpd/error_log
''' >> /etc/awslogs/awslogs.conf
systemctl start awslogsd
systemctl enable awslogsd.service