0
我需要你的帮助。 我有fluentd
配置为尾部模式将我的日志发送到elasticsearch
群集。 我使用的是regex
来解析每个日志行,但对于一些字段,我需要将metricValue
转换为integer
。我尝试了一些东西,但没有工作。fluentd转换字段为整数
这里是我的fluentd的conf文件:
<source>
@type tail
path /tmp/application.log
pos_file /tmp/access.log.pos
format multi_format
tag first.log
<pattern>
format /(?<app>.*)\((?<instance>.*)\) CID\((?<correlationId>.*)\) (?<level>.*) \[(?<timestamp>.*)\] \[(?<Thread>.*)\] (?<class>.*) - \[Provider:(?<providerName>.*),Curef:(?<cuRef>.*),Operation:(?<operation>.*),Reference:(?<reference>.*),Idx:(?<idx>.*)\]/
</pattern>
<pattern>
format /(?<app>.*)\((?<instance>.*)\) CID\((?<correlationId>.*)\) (?<level>.*) \[(?<timestamp>.*)\] \[(?<Thread>.*)\] (?<class>.*) - (?<body>.*)/
</pattern>
</source>
<match *.log>
@type copy
<store>
@type stdout
</store>
<store>
@type elasticsearch
host localhost
port 9200
logstash_format true
logstash_prefix fluentd-log
flush_interval 10s
</store>
</match>
我的fluend文档语法中发现的,但不工作(我不知道从哪里把这些线)
types <field_name_1>:<type_name_1>,<field_name_2>:<type_name_2>,...
我想在发送到elasticsearch
之前将字段metricValue转换为整数。
谢谢你的任何想法。
C.C.