日志服务(Cloud Log Service,CLS)提供一站式的日志数据解决方案。您无需关注扩缩容等资源问题,五分钟快速便捷接入,即可享受从日志采集、日志存储到日志内容搜索、统计分析等全方位稳定可靠的日志服务。帮助您轻松解决业务问题定位,指标监控、安全审计等日志问题。大大降低日志运维门槛。
API方式采集:通过调用日志服务API上传结构化日志至日志服务
SDK方式采集:通过SKD的方式采集日志
LogListener 客户端采集:通过部署安装部署 LogListener,可以方便快速地接入日志服务,无需修改应用程序运行逻辑,是一种对应用服务无侵入式的采集方式。
本文【快速采集Linux日志到日志服务CLS】将通过LogListener客户端采集Linux的日志。
使用 LogListener 采集日志的流程如下图所示:
下面开始此次教程
日志服务产品地址:https://cloud.tencent.com/product/cls
安装环境:LogListener 仅支持64位 Linux 操作系统环境(暂不支持 Windows),并适配主流 Linux 操作系统版本
1.首先下载并安装LogListener:
运行以下命令(默认安装在/usr/local/目录):
wget https://loglistener-1254077820.cos.ap-shanghai.myqcloud.com/loglistener-linux-x64-2.5.8.tar.gz && tar -zxvf loglistener-linux-x64-2.5.8.tar.gz -C /usr/local && cd /usr/local/loglistener-2.5.8/tools && ./loglistener.sh install
出现以下提示即代表安装成功
./loglistener.sh init -secretid AKIDPEtPyKabfW8Z3Uspdz83xxxxxxxxxxx
-secretkey whHwQfjdLnzzCE1jIf09xxxxxxxxxxxx
-region ap-xxxxxx
绿色加粗部分需自省替换(默认使用内网方式访问服务)
如果使用外网请使用:
./loglistener.sh init -secretid AKIDPEtPyKabfW8Z3Uspdz83xxxxxxxxxxx
-secretkey whHwQfjdLnzzCE1jIf09xxxxxxxxxxxx
-region ap-xxxxxx
-network internet
在访问管理页面 找到访问秘钥选项卡 点击新建秘钥
复制并替换刚刚的SecretId和SecretKey
SecretId和SecretKey请注意保密,您的 API 密钥代表您的账号身份和所拥有的权限,等同于您的登录密码,切勿泄露他人
打开CLS控制台 找到概况中的地域 替换刚刚的region
比如我使用了中国香港 则替换成ap-hongkong
地域 | 域名简称 | 内网域名 | 外网域名 |
---|---|---|---|
ap-beijing | ap-beijing.cls.tencentyun.com | ap-beijing.cls.tencentcs.com | |
广州 | ap-guangzhou | ap-guangzhou.cls.tencentyun.com | ap-guangzhou.cls.tencentcs.com |
ap-shanghai | ap-shanghai.cls.tencentyun.com | ap-shanghai.cls.tencentcs.com | |
ap-chengdu | ap-chengdu.cls.tencentyun.com | ap-chengdu.cls.tencentcs.com | |
ap-nanjing | ap-nanjing.cls.tencentyun.com | ap-nanjing.cls.tencentcs.com | |
ap-chongqing | ap-chongqing.cls.tencentyun.com | ap-chongqing.cls.tencentcs.com | |
中国香港 | ap-hongkong | ap-hongkong.cls.tencentyun.com | ap-hongkong.cls.tencentcs.com |
硅谷 | na-siliconvalley | na-siliconvalley.cls.tencentyun.com | na-siliconvalley.cls.tencentcs.com |
弗吉尼亚 | na-ashburn | na-ashburn.cls.tencentyun.com | na-ashburn.cls.tencentcs.com |
新加坡 | ap-singapore | ap-singapore.cls.tencentyun.com | ap-singapore.cls.tencentcs.com |
泰国 | ap-bangkok | ap-bangkok.cls.tencentyun.com | ap-bangkok.cls.tencentcs.com |
孟买 | ap-mumbai | ap-mumbai.cls.tencentyun.com | ap-mumbai.cls.tencentcs.com |
法兰克福 | eu-frankfurt | eu-frankfurt.cls.tencentyun.com | eu-frankfurt.cls.tencentcs.com |
东京 | ap-tokyo | ap-tokyo.cls.tencentyun.com | ap-tokyo.cls.tencentcs.com |
首尔 | ap-seoul | ap-seoul.cls.tencentyun.com | ap-seoul.cls.tencentcs.com |
莫斯科 | eu-moscow | eu-moscow.cls.tencentyun.com | eu-moscow.cls.tencentcs.com |
深圳金融 | ap-shenzhen-fsi | ap-shenzhen-fsi.cls.tencentyun.com | ap-shenzhen-fsi.cls.tencentcs.com |
上海金融 | ap-shanghai-fsi | ap-shanghai-fsi.cls.tencentyun.com | ap-shanghai-fsi.cls.tencentcs.com |
北京金融 | ap-beijing-fsi | ap-beijing-fsi.cls.tencentyun.com | ap-beijing-fsi.cls.tencentcs.com |
如下图,配置成功
/etc/init.d/loglistenerd start
然后就可以在机器组管理中看到刚刚添加的服务器
到这里LogListener客户端的安装就完毕了
点击提交
然后到检索选项卡就可以看到相关日志
根据裸金属服务器的网络设置,以及您本地设备的操作系统,您可以选择合适的方法...
阿里巴巴程序员的速度 论技术水平没得说 论干饭能力 也是惊人 阿里人1年吃掉495...
云岫资本企服组 2021 年 3 月 【前言】随着业务上云、生态协作、多云混合等场景...
基本介绍 过去十年来,OAuth2授权协议备受争议,您可能已经听说过很多return_uri...
TOP云 1月11日讯,纵观上周西数平台的交易纪录,在一口价前三和竞拍价前三的榜单...
问题描述 Linux裸金属服务器的静态主机名来源于创建裸金属服务器时,通过控制台...
背景介绍 ? ? ? ? 为了摸底项目的性能,需要进行性能测试。经过一番调研之后,决...
一、数据结构的存储方式 数据结构的存储方式只有两种:数组(顺序存储)和链表(链...
边缘计算的下一步是什么,它将如何影响您的战略?专家权衡边缘趋势并讨论工作负载...
无论是专业的数据分析师还是销售、人力等基本的业务岗位,在汇报时总是免不了要...