java.lang.NullPointerException: Expected timestamp2014-08-30 csdn博客 fansy1990java.lang.NullPointerException: Expected timestamp in the Flume event headers, but it was nulljava.lang.NullPointerException: Expected timestamp in the Flume event headers, but it was null使用flume的时候出现的问题。sink是hdfs,然后使用目录自动生成功能。出现如题的错误,看官网文档说的是需要在每个文件记录行的开头需要有时间戳,但是时间戳的格式可能比较难调节,所以亦可设置hdfs.useLocalTimeStamp这个参数,比如以每个小时作为一个文件夹,那么配置应该是这样:
a1.sinks.k1.hdfs.path = hdfs://ubuntu:9000/flume/events/%y-%m-%d/%Ha1.sinks.k1.hdfs.filePrefix = events-a1.sinks.k1.hdfs.round = truea1.sinks.k1.hdfs.roundValue = 1a1.sinks.k1.hdfs.roundUnit = houra1.sinks.k1.hdfs.useLocalTimeStamp = true
或者修改hdfs.timeZone这个参数使之可以和我们上传的log文件的日期格式一样应该就可以了,没有测试过。