ECS上安装docker运行阿里云日志服务demo

ECS上安装docker运行阿里云日志服务demo

  1. yum 安装docker
yum install docker
Installing:
 docker                                                 x86_64                          2:1.12.6-11.el7.centos                           extras                            20 M
Installing for dependencies:
 device-mapper-persistent-data                          x86_64                          0.6.3-1.el7                                      base                             368 k
 libaio                                                 x86_64                          0.3.109-13.el7                                   base                              24 k
 lvm2                                                   x86_64                          7:2.02.166-1.el7_3.3                             updates                          1.1 M
Updating for dependencies:
 device-mapper                                          x86_64                          7:1.02.135-1.el7_3.3                             updates                          269 k
 device-mapper-event                                    x86_64                          7:1.02.135-1.el7_3.3                             updates                          178 k
 device-mapper-event-libs                               x86_64                          7:1.02.135-1.el7_3.3                             updates                          177 k
 device-mapper-libs                                     x86_64                          7:1.02.135-1.el7_3.3                             updates                          333 k
 lvm2-libs                                              x86_64                          7:2.02.166-1.el7_3.3                             updates                          986 k

Transaction Summary
================================================================================================================================================================================
Install  1 Package  (+3 Dependent packages)
Upgrade             ( 5 Dependent packages)

Total size: 23 M
Total download size: 20 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): libaio-0.3.109-13.el7.x86_64.rpm                                                                                                                  |  24 kB  00:00:00     
(2/3): device-mapper-persistent-data-0.6.3-1.el7.x86_64.rpm                                                                                              | 368 kB  00:00:01

  1. 运行docker服务(守护进程开启)
[root@iz2ze1yajhh9duog797s09z ~]# service docker start
Redirecting to /bin/systemctl start  docker.service
[root@iz2ze1yajhh9duog797s09z ~]# docker -v
Docker version 1.12.6, build 96d83a5/1.12.6

  1. 拉取dashboard的docker镜像
-bash: pull: command not found
[root@iz2ze1yajhh9duog797s09z ~]# docker pull registry.aliyuncs.com/aliyunlog/access_log_stat_dashboard
Using default tag: latest
Trying to pull repository registry.aliyuncs.com/aliyunlog/access_log_stat_dashboard ... 
latest: Pulling from registry.aliyuncs.com/aliyunlog/access_log_stat_dashboard

203137e8afd5: Pull complete 
abe49d2cd8a3: Pull complete 
8aa1bb7b3b52: Pull complete 
a3ed95caeb02: Pull complete 
40351941afea: Pull complete 
e0bda9870431: Pull complete 
a1d1555c6437: Pull complete 
be500aaf15b1: Pull complete 
4d3067b067d8: Pull complete 
f305c8aa34e8: Pull complete 
bf41a28c7966: Pull complete 
ebc6c871c4bb: Pull complete 
0db5820a4eb0: Pull complete 
7c96b247f381: Pull complete 
8a0fc656205d: Pull complete 
4da0c7fd66bb: Pull complete 
a11629875ec8: Pull complete 
af19e6638c60: Pull complete 
c8933fd4a398: Pull complete 
8d323f5e04bd: Pull complete 
c1d885422272: Pull complete 
509eefa12a43: Pull complete 
Digest: sha256:1503ab41efc8f13b11c66c64f892fb2af8b3952ceefbae8b68accb459c751a34

  1. 运行镜像
[root@iz2ze1yajhh9duog797s09z default]# docker run --dns 223.5.5.5 --name docker-ecs-log -p  8080:80  -d registry.aliyuncs.com/aliyunlog/access_log_stat_dashboard
d1c81d7ac73ce92073165f86587f440b0cd739070a4083354f884c5a44dfee38
–name 为启动的容器命名
-p 8080:80 把本机8080端口映射到容器的80端口,使访问本机8080端口能够访问容器里的服务

  1. 访问ECS的8080端口,即可访问到阿里云日志服务demo

  1. 配置logtail提取字段以便demo正常统计日志数据
日志正则示例:
182.43.132.114 - - [20/Apr/2017:15:08:04 +0800] "GET /iest/assets/fonts/fontawesome-webfont.woff2?v=4.6.3 HTTP/1.1" 200 71896
正则:
(\d*.\d*.\d*.\d*)\s-\s-\s\[([^]]+)]\s"(\w+)(\s\S+)\s[^"]+"\s(\d+)\s(\d+).*

你可能感兴趣的:(日志服务,日志分析,阿里云,yum,logtail)