Flume morphline拦截器 - 拆分命令

时间:2017-02-06 07:48:22

标签: flume morphline

您好我尝试使用morphline inteceptor并将我的系统日志转换为JSON 为了开始我尝试使用split命令来分割我的字符串,但我得到如下错误:

""由于配置期间出错,源r1已被删除 com.typesafe.config.ConfigException $ WrongType:/root/flume.17/conf/morph.conf:21:无法将对象或列表与非对象或列表,ConfigString连接(" split" )和SimpleConfigObject({" outputFields":" substrings"," inputField":" message"," addEmptyStrings": false," isRegex":false," trim":true," separator":""})不兼容"& #34;

我的morphline配置文件:

morphlines : [
{
# Name used to identify a morphline. E.g. used if there are multiple
# morphlines in a morphline config file
id : morphline1

# Import all morphline commands in these java packages and their
# subpackages. Other commands that may be present on the classpath are
# not visible to this morphline.
importCommands : ["org.kitesdk.**"]

commands : [
  {
    # Parse input attachment and emit a record for each input line              

readLine {
      charset : UTF-8
    }
  }

  ,split {
  inputField : message
  outputFields : "substrings"     
  separator : " "       
  isRegex : false     

  addEmptyStrings : false
  trim : true          }
       }
      }

   ]
  }
 ]

我该怎么做?我是这个

的新手

1 个答案:

答案 0 :(得分:0)

来自morhpline文档

  

outputField - 要将输出值添加到的字段的名称,即单个字符串。示例:令牌。必须存在outputField或outputFields之一,但不能同时存在。

     

outputFields - 要添加输出值的字段的名称,即字符串列表。示例:[firstName,lastName,“”,age]。列表中的空字符串表示输出中省略了此列。必须存在outputField或outputFields之一,但不能同时存在。

所以你应该指定

outputField : substrings

而不是

outputFields : "substrings"

http://kitesdk.org/docs/1.1.0/morphlines/morphlines-reference-guide.html#split

相关问题