1. 日志格式 

#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: -- ::
#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status
-- :: W3SVC1 :da8:::: GET /skin6/film_sort.asp id= - :da8::f07:ac50:d2b:f22d:5dec Mozilla/5.0+(Windows+NT+6.1;+Trident/7.0;+rv:11.0)+like+Gecko
-- :: W3SVC1 :da8:::: GET /news.asp - - :da8::f07:ac50:d2b:f22d:5dec Mozilla/5.0+(Windows+NT+6.1;+Trident/7.0;+rv:11.0)+like+Gecko
-- :: W3SVC1 :da8:::: GET /UploadFile/.jpg - - :da8::f07:ac50:d2b:f22d:5dec Mozilla/5.0+(Windows+NT+6.1;+Trident/7.0;+rv:11.0)+like+Gecko

2. 建立的对应的hive表:

CREATE EXTERNAL  TABLE IF NOT EXISTS exmovielog
(
log_date TIMESTAMP,
s_sitename STRING,
s_ip STRING,
cs_method STRING,
cs_uri_stem STRING,
cs_uri_query STRING,
s_port INT,
cs_username STRING,
c_ip STRING,
user_agen STRING,
sc_status INT,
sc_substatus INT,
sc_win32_status INT
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '`'
LOCATION '/movielog';

3. flume配置文件

  

agent1.sources = source1
agent1.channels = channel1
agent1.sinks = sink1 # Each channel's type is defined.
agent1.channels.channel1.type = file
agent1.channels.channel1.checkpointDir = /home/hadoop_admin/flumeTemp/fchannel/spool/checkpoint
agent1.channels.channel1.dataDirs = /home/hadoop_admin/flumeTemp/fchannel/spool/data
agent1.channels.channel1.capacity = # For each one of the sources, the type is defined
agent1.sources.source1.type = spooldir
agent1.sources.source1.inputCharset = GBK
agent1.sources.source1.spoolDir =/home/hadoop_admin/movielog
agent1.sources.source1.fileHeader = true
agent1.sources.source1.deletePolicy = immediate
agent1.sources.source1.batchSize =
agent1.sources.source1.channels = channel1
# remove the line that starts with '#'
agent1.sources.source1.interceptors = i1 search-replace1 search-replace2 search-replace3
agent1.sources.source1.interceptors.i1.type = regex_filter
agent1.sources.source1.interceptors.i1.regex = ^[^#].*$
# the default value of this configuration is flase
# agent1.sources.source1.interceptors.i1.excludeEvents = true
# agent1.sources.source1.interceptors.i1.regex = ^# # connect the date and time to be a timestamp
agent1.sources.source1.interceptors.search-replace1.type = search_replace
agent1.sources.source1.interceptors.search-replace1.searchPattern = (\\d\\d\\d\\d-\\d\\d-\\d\\d)\\s(\\d\\d:\\d\\d:\\d\\d)
agent1.sources.source1.interceptors.search-replace1.replaceString = $1T$
# change the split char
agent1.sources.source1.interceptors.search-replace2.type = search_replace
agent1.sources.source1.interceptors.search-replace2.searchPattern = \\s
agent1.sources.source1.interceptors.search-replace2.replaceString = ` agent1.sources.source1.interceptors.search-replace3.type = search_replace
agent1.sources.source1.interceptors.search-replace3.searchPattern = (\\d\\d\\d\\d-\\d\\d-\\d\\d)T(\\d\\d:\\d\\d:\\d\\d)
agent1.sources.source1.interceptors.search-replace3.replaceString = $ $ # Each sink's type must be defined
agent1.sinks.sink1.type = hdfs
agent1.sinks.sink1.channel = channel1
agent1.sinks.sink1.hdfs.path = hdfs://master:9000/movielog
agent1.sinks.sink1.hdfs.writeFormat = Text
agent1.sinks.sink1.hdfs.fileType = DataStream
agent1.sinks.sink1.hdfs.rollInterval =
agent1.sinks.sink1.hdfs.idleTimeout =
agent1.sinks.sink1.hdfs.rollCount =
agent1.sinks.sink1.hdfs.rollSize =
agent1.sinks.sink1.hdfs.batchSize =
agent1.sinks.sink1.hdfs.callTimeout =

简单的Flume和hive的结合的更多相关文章

  1. Flume + HDFS + Hive日志收集系统

    最近一段时间,负责公司的产品日志埋点与收集工作,搭建了基于Flume+HDFS+Hive日志搜集系统. 一.日志搜集系统架构: 简单画了一下日志搜集系统的架构图,可以看出,flume承担了agent与 ...

  2. flume 测试 hive sink

    测试flume,将数据送到hive表中,首先建表. create table order_flume( order_id string, user_id string, eval_set string ...

  3. 从0到1搭建基于Kafka、Flume和Hive的海量数据分析系统(一)数据收集应用

    大数据时代,一大技术特征是对海量数据采集.存储和分析的多组件解决方案.而其中对来自于传感器.APP的SDK和各类互联网应用的原生日志数据的采集存储则是基本中的基本.本系列文章将从0到1,概述一下搭建基 ...

  4. 简单测试flume+kafka+storm的集成

    集成 Flume/kafka/storm 是为了收集日志文件而引入的方法,最终将日志转到storm中进行分析.storm的分析方法见后面文章,这里只讨论集成方法. 以下为具体步骤及测试方法: 1.分别 ...

  5. 简单模拟flume

    NetCat方式: 远程访问的方式进行消息传递 配置一个Agent,主要配置三个组件: source, channel, sink 上图中为什么channel会带s,变成channels? 可以绑定多 ...

  6. Flume架构以及应用介绍[转]

    在具体介绍本文内容之前,先给大家看一下Hadoop业务的整体开发流程: 从Hadoop的业务开发流程图中可以看出,在大数据的业务处理过程中,对于数据的采集是十分重要的一步,也是不可避免的一步,从而引出 ...

  7. Flume架构以及应用介绍

    在具体介绍本文内容之前,先给大家看一下Hadoop业务的整体开发流程:  从Hadoop的业务开发流程图中可以看出,在大数据的业务处理过程中,对于数据的采集是十分重要的一步,也是不可避免的一步,从而引 ...

  8. Flume初始

    一.Flume是什么 Flume是一个数据,日志收集的一个组件,可以用于对程序,nginx等日志的收集,而且非常简单,省时的做完收集的工作.Flume是一个分布式.可靠.和高可用的海量日志采集聚合和传 ...

  9. Flume日志收集系统介绍

    转自:http://blog.csdn.net/a2011480169/article/details/51544664 在具体介绍本文内容之前,先给大家看一下Hadoop业务的整体开发流程: 从Ha ...

随机推荐

  1. 解决xib约束冲突

    I would recommend to debug and find which constraint is "the one you don't want". Suppose ...

  2. [Android Pro] Gradle Tips#2-语法

    referece to : http://blog.csdn.net/lzyzsd/article/details/46935063 在第一篇博客中,我讲解了关于tasks和构建过程中task的不同阶 ...

  3. Mysql源码分析--csv存储引擎

    一直想分析下mysql的源码,开始的时候不知道从哪下手,先从csv的文件存储开始吧,这个还是比较简单的.我是用的是mysql5.7.16版本的源码. csv源码文件在mysql源码的mysql-5.7 ...

  4. iOS 8 AutoLayout与Size Class

    转自:http://www.cocoachina.com/ios/20141217/10669.html 前言 iOS8 和iPhone6发布已经过去蛮久了,广大的果粉终于迎来了大屏iPhone,再也 ...

  5. window 环境安装MongoDB

    强制安装mongodb服务 命令 sc create MongoDB binPath= "D:\MongoDB\Server\3.2\bin\mongod.exe --service --d ...

  6. mySQL中如何给某一IP段的用户授权?

    给一个用用户use ip: 192.168.0.1 语句是: grant all on *.* to root@192.168.0.1 identified by 'pass' 来授权 其中:root ...

  7. tableView 局部刷新

    //一个section刷新 NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2]; [tableview reloadSections:in ...

  8. HDU1899 Sum the K-th's(树状数组)

    枚举,每次增加点,删除点 #include<cstdio> #include<iostream> #include<cstdlib> #include<cst ...

  9. B树算法与实现 (C语言实现)

    B树的定义 假设B树的度为t(t>=2),则B树满足如下要求:(参考算法导论) (1)  每个非根节点至少包含t-1个关键字,t个指向子节点的指针:至多包含2t-1个关键字,2t个指向子女的指针 ...

  10. 【leetcode】Sqrt(x)

    题目描述: Implement int sqrt(int x). Compute and return the square root of x. 实现开根号,并且返回整数值(这个很重要,不是整数的话 ...