【发布时间】:2017-04-18 15:39:24
【问题描述】:
正在尝试使用 fluentd 将 mysql 日志集中到弹性搜索中。
我看到的问题是搜索中的时间戳与日志中的时间戳不匹配。
这是我的流利配置:
<source>
@type tail
path /logs/mysql/audit.log
pos_file /var/log/td-agent/audit.log.pos
tag mysql.audit
format json
</source>
<match mysql.audit>
type elasticsearch
host isolinear-eg.corp.apple.com
port 9200
index_name mysql_audit
include_tag_key true
logstash_format true
logstash_prefix mysql_audit
time_key audit_record.timestamp
time_format %Y-%m-%dT%H:%M:%S %Z
flush_interval 10s # for testing
</match>
这是输出:
{
"_index": "mysql_audit-2017.04.18",
"_type": "fluentd",
"_id": "AVuBrutMy6H0rNsJZZHy",
"_score": null,
"_source": {
"audit_record": {
"name": "Connect",
"record": "447474053_2017-04-11T22:30:21",
"timestamp": "2017-04-18T15:29:01 UTC",
"connection_id": "21450",
"status": 0,
"user": "solver",
"priv_user": "solver",
"os_login": "",
"proxy_user": "",
"host": "",
"ip": "10.108.251.201",
"db": "solver"
},
"tag": "mysql.audit",
"@timestamp": "2017-04-18T10:29:02-05:00"
},
"fields": {
"@timestamp": [
1492529342000
]
},
"sort": [
1492529342000
]
}
我看到的问题是时间戳与审计记录时间戳不匹配。
【问题讨论】:
标签: elasticsearch record fluentd transformer