記事:
docs:
エラー:
aws firehose create-delivery-stream --cli-input-json file://input.json --profile example Verify that the IAM role has access to the Elasticsearch cluster endpoint: https://...
解決方法:
... "Effect": "Allow", "Principal": { "AWS": [ "arn:aws:iam::<AWS account B id>:role/<firehose role name>", ... "Action": "es:ESHttpGet", "Resource": [ "arn:aws:es:ap-northeast-1:<AWS account A id>:domain/<domain name>/*" ...
... "Action": "es:ESHttpGet", "Resource": [ "arn:aws:es:ap-northeast-1:<AWS account A id>:domain/<domain name>/*" ...
Data Firehorseでs3へ集めたログをAthenaやGlue等で検索する時、パーティション(s3://bucket/prefix/dt=<YYYY-mm-dd-HH>/file.gz)があったほうが速度、金額的に良い。
locals { s3_datetime_partition1 = "dt=!{timestamp:yyyy}-!{timestamp:MM}-!{timestamp:dd}-!{timestamp:HH}" s3_datetime_partition2 = "year=!{timestamp:yyyy}/month=!{timestamp:MM}/day=!{timestamp:dd}/hour=!{timestamp:HH}" s3_prefix = "host/id=example/${local.s3_datetime_partition1}/ec2_instance_id=!{partitionKeyFromQuery:ec2_instance_id}/" }
AWSの最近の対応(Fargate, docker image提供)を見ると、この選択肢が良さそう
sudo usermod -aG wheel aws-kinesis-agent-user sudo chown :wheel /tmp/app.log sudo chmod 640 /tmp/app.log
cat /etc/logrotate.d/aws-kinesis-agent /var/log/aws-kinesis-agent/*.log { missingok notifempty compress dateext copytruncate create 0664 aws-kinesis-agent-user aws-kinesis-agent-user su aws-kinesis-agent-user aws-kinesis-agent-user }
{ "cloudwatch.emitMetrics": false, "cloudwatch.endpoint": "monitoring.ap-northeast-1.amazonaws.com", "firehose.endpoint": "firehose.ap-northeast-1.amazonaws.com", "kinesis.endpoint": "", "flows": [ ] }
{ "flows": [ { "filePattern": "/tmp/app.log*", "deliveryStream": "yourdeliverystream" } ] }
{ "flows": [ { "filePattern": "/tmp/app.log*", "deliveryStream": "yourdeliverystream" } ] }
{ "flows": [ { "dataProcessingOptions": [ { "logFormat": "SYSLOG", "optionName": "LOGTOJSON" } ], "deliveryStream": "yourdeliverystream", "filePattern": "/var/log/messages*" } ] }
{ "flows": [ { "dataProcessingOptions": [ { "logFormat": "SYSLOG", "optionName": "LOGTOJSON" }, { "logFormat": "SYSLOG", "optionName": "ADDEC2METADATA" } ], "deliveryStream": "yourdeliverystream", "filePattern": "/var/log/messages*" } ] }