Fluentd 外部命令无法通过td代理
此bash命令“Fluentd 外部命令无法通过td代理,fluentd,td-agent,Fluentd,Td Agent,此bash命令“etcdctl get system config/log/timestamp”返回UTC或system的时间类型。现在我想用它把时间转换成相同的格式。我该怎么做 我试过了,但td代理运行失败 <source> @type exec command etcdctl get system config/log/timestamp <parse> keys timeType </parse> </source>
etcdctl get system config/log/timestamp
”返回UTC或system的时间类型。现在我想用它把时间转换成相同的格式。我该怎么做
我试过了,但td代理运行失败
<source>
@type exec
command etcdctl get system config/log/timestamp
<parse>
keys timeType
</parse>
</source>
这就是我想使用$timeType的地方
<filter com.logging.tmplog>
@type record_modifier
<record>
type log
time ${record["time"]}.$timeType ## It's not working
arun ${tag}
</record>
</filter>
@类型记录修饰符
打字日志
时间${record[“time”]}.$timeType##它不工作
阿伦${tag}
该问题通过使用记录修改器的prepare\u值来解决
@类型记录修饰符
准备_value@timeType=
`etcdctl获取系统配置/log/timestamp`.strip
时间类型${@timeType}
时间${如果@timeType='UTC',那么time.at(time).UTC.strftime(“%FT%T”)else time.at(time).to_s;end}
为什么这被标记为一个问题?我这么做是因为fluentd在ruby中有插件。因此,解决方案可能是ruby
<filter com.logging.tmplog>
@type record_modifier
<record>
type log
time ${record["time"]}.$timeType ## It's not working
arun ${tag}
</record>
</filter>