阿里云日志消费
Posted Sicc1107
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云日志消费相关的知识,希望对你有一定的参考价值。
阿里云日志官方文档地址
https://help.aliyun.com/document_detail/64802.html
查看支持阿里云日志的产品
使用logstash消费模式
以短信日志接入为例
官方文档地址
https://help.aliyun.com/document_detail/152663.html
1 开通短信服务日志分析功能
系统默认创建一个名为sms-log-阿里云账号ID的Project,以及一个名为sms-log的专属Logstore。
2 日志服务sls 开通权限
权限助手配置官方文档地址:https://help.aliyun.com/document_detail/155426.htm?
logstash部署
#使用模版配置文件启动,先安装插件
#配置
input
beats
port => 5044
output
stdout
codec => rubydebug
#启动
docker run -d \\
--name=logstash \\
--restart=always \\
-v /home/logs/sms/:/home/logs/sms/ \\
-v /home/logstash/conf/logstash.conf:/usr/share/logstash/pipeline/logstash.conf \\
logstash:7.5.1
#安装插件
docker exec -it logstash /bin/sh
logstash-plugin install logstash-input-sls
#修改配置文件 配置说明查看https://help.aliyun.com/document_detail/121080.html #Logstash消费
input
logservice
endpoint => "cn-hangzhou.log.aliyuncs.com"
access_id => "aaa"
access_key => "bbb"
project => "sms-log"
logstore => "sms-log"
consumer_group => ""
consumer_name => ""
position => "end"
checkpoint_second => 30
include_meta => true
consumer_name_with_ip => true
type => "sms"
input
logservice
endpoint => "cn-hangzhou.log.aliyuncs.com"
access_id => "aaa"
access_key => "bbb"
project => "slb-log"
logstore => "slb-log"
consumer_group => ""
consumer_name => ""
position => "end"
checkpoint_second => 30
include_meta => true
consumer_name_with_ip => true
type => "slb"
output
stdout
codec => rubydebug
if [type] == "sms"
file
path => "/home/logs/sms/sms%+yyyy-MM-dd-HH.log"
if [type] == "slb"
file
path => "/home/logs/slb/slb%+yyyy-MM-dd-HH.log"
#确认结果
tail -f -n 3 /home/logs/sms/sms.log
以上是关于阿里云日志消费的主要内容,如果未能解决你的问题,请参考以下文章