我设法通过 kinesis-agent 和 firehose 将我的 Apache access_log (httpd / amazon-linux-ami 2016.09 / php5.6) 发送到 elasticsearch。
现在我正在努力转发error_log。
我的agent.json
:
{
"cloudwatch.emitMetrics": true,
"kinesis.endpoint": "",
"firehose.endpoint": "firehose.eu-west-1.amazonaws.com",
"flows": [{
"filePattern": "/var/log/httpd/error_log*",
"deliveryStream": "xxxx",
"dataProcessingOptions": [{
"optionName": "LOGTOJSON",
"logFormat": "APACHEERRORLOG"
}]
}, {
"filePattern": "/var/log/httpd/access_log*",
"deliveryStream": "xxxx",
"dataProcessingOptions": [{
"optionName": "LOGTOJSON",
"logFormat": "COMMONAPACHELOG"
}]
}]
}
来自的示例行/var/log/httpd/error_log
:
[Thu Feb 16 16:56:19.240650 2017] [:error] [pid 10719] [client 1.1.1.1:60890] PHP Notice: Undefined variable: env in /var/www/html/development/index.php on line 34
正如我所说,所有 access_logs 都正确转发。但是没有错误日志被发送到目的地。见下文/var/log/aws-kinesis-agent/aws-kinesis-agent.log
:
2017-02-17 06:32:05.486+0000 ip-172-31-7-92 (FileTailer[fh:xxx:/var/log/httpd/error_log*].MetricsEmitter RUNNING) com.amazon.kinesis.streaming.agent.tailing.FileTailer [INFO] FileTailer[fh:xxx:/var/log/httpd/error_log*]: Tailer Progress: Tailer has parsed 414 records (116864 bytes), transformed 0 records, skipped 414 records, and has successfully sent 0 records to destination.
xxx
是我的消防水带目的地(两者都相同)。
对我来说,我的 apache 错误日志(默认格式,我没有更改任何内容)似乎符合 APACHEERRORLOG 预期的格式。
我在这里想念什么?非常感谢一些指点,非常感谢!