784
小米笔记本
Fluentd MaxCompute插件__数据入云_数据集成-阿里云
Fluentd是一个日志收集系统,它的特点在于其各部分均是可定制化的,你可以通过简单的配置,将日志收集到不同的地方。本文介绍如何通过Fluentd将日志上传到ODPS DataHub。
二、环境要求
- Ruby 2.1.0
- Gem 2.4.5 or later
- Fluentd-0.10.49 or later
- Protobuf-3.5.1 or later
三、安装步骤
安装依赖:
gem install protobuf
gem install fluentd --no-ri --no-rdoc
安装插件:
gem install fluent-plugin-aliyun-odps
四、配置实例
- 创建odps datahub表:
create table nginx_logs(remote string, accesstime string, method string, path string, code string, size string, agent string) into 5 shards hublifecycle 7;
- 修改fluentd配置文件,将nigix日志实时传入odps datahub表。
<source>
type tail
path /logs/access.log
pos_file /tmp/nginx.access.pos
refresh_interval 5s
tag nginx.access
format /^(?<remote>[^ ]*) - - [(?<accesstime>[^]]*)] "(?<method>S+)(?: +(?<path>[^"]*?)(?: +S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*) "-" "(?<agent>[^"]*)"$/
time_format %Y%b%d %H:%M:%S %z
</source>
<match **>
type aliyun_odps
aliyun_access_id ************
aliyun_access_key ************
aliyun_odps_endpoint https://service.odps.aliyun.com/api/
aliyun_odps_hub_endpoint https://dh.odps.aliyun.com
project test
buffer_chunk_limit 2m
buffer_queue_limit 128
flush_interval 5s
<table nginx.access>
table nginx_logs
fields remote,accesstime,method,path,code,size,agent
shard_number 5
</table>
</match>
- 启动fluentd,如果有类似如下的输出,就可以说明数据实时写入Datahub服务已经成功。
2015-08-19 16:41:15 +0800 [info]: 5 records to be sent
2015-08-19 16:41:15 +0800 [info]: Successfully import 5 data to table:nginx_logs at threadId:0
五、了解更多
最后更新:2016-11-24 11:23:47
上一篇:
Flume MaxCompute Sink插件__数据入云_数据集成-阿里云
下一篇:
OGG MaxCompute插件__数据入云_数据集成-阿里云
Java 收发消息__HTTP 接入(简单)_消息队列 MQ-阿里云
计划任务__系统管理_用户指南(Linux)_数据管理-阿里云
BandwidthPackagePublicIpMonitorDataSetType__数据类型_API参考_专有网络 VPC-阿里云
实验目标__快速入门_推荐引擎-阿里云
ROS区域列表__调用方式_API 文档_资源编排-阿里云
标签建模__产品与架构介绍_画像分析-阿里云
主账号管理__账号管理_用户指南_企业级分布式应用服务 EDAS-阿里云
实例状态图__附录_API 参考_云服务器 ECS-阿里云
EcsOrder__数据类型_API参考_E-MapReduce-阿里云
SQL Server不停机迁移__数据迁移_用户指南_数据传输-阿里云
相关内容
常见错误说明__附录_大数据计算服务-阿里云
发送短信接口__API使用手册_短信服务-阿里云
接口文档__Android_安全组件教程_移动安全-阿里云
运营商错误码(联通)__常见问题_短信服务-阿里云
设置短信模板__使用手册_短信服务-阿里云
OSS 权限问题及排查__常见错误及排除_最佳实践_对象存储 OSS-阿里云
消息通知__操作指南_批量计算-阿里云
设备端快速接入(MQTT)__快速开始_阿里云物联网套件-阿里云
查询API调用流量数据__API管理相关接口_API_API 网关-阿里云
使用STS访问__JavaScript-SDK_SDK 参考_对象存储 OSS-阿里云