\u30a2\u30e9\u30fc\u30c8\u8a2d\u5b9a\u3092\u884c\u306a\u3063\u3066\u3044\u305f\u5834\u5408\u3001\u30a2\u30d7\u30ea\u3068\u306f\u95a2\u4fc2\u306e\u306a\u3044\u30a8\u30e9\u30fc\u3067\u30a2\u30e9\u30fc\u30c8\u304c\u767a\u5831\u3055\u308c\u3066\u3057\u307e\u3046<\/strong><\/li>\n<\/ul>\n\u3068\u3044\u3063\u305f\u30ea\u30b9\u30af\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n
\u30b3\u30f3\u30c6\u30ca\u3054\u3068\u306b\u8ee2\u9001\u3055\u308c\u308b\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u6599\u91d1\u30b3\u30b9\u30c8\u306e\u524a\u6e1b\u30fb\u671f\u5f85\u901a\u308a\u306e\u76e3\u8996\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n
<\/p>\n
\u7d50\u8ad6<\/h2>\n
OUTPUT<\/code>\u306eMatch<\/code>\u3092\u5206\u985e\u3059\u308b\u3053\u3068\u3067\u5b9f\u73fe\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\u3053\u306eMatch<\/code>\u306b\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u3068\u4e00\u81f4\u3059\u308b\u30bf\u30b0\u306e\u30ed\u30b0\u306e\u307f\u304c\u3001log_group_name<\/code>\u3067\u6307\u5b9a\u3055\u308c\u305f\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3078\u3068\u8ee2\u9001\u3055\u308c\u308b\u4ed5\u7d44\u307f\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\u5404\u30b3\u30f3\u30c6\u30ca\u3054\u3068\u306b\u8a2d\u5b9a\u3055\u308c\u308b\u30bf\u30b0\u306f\u7570\u306a\u308b\u305f\u3081\u3001\u30ed\u30b0\u3092\u8ee2\u9001\u3055\u305b\u305f\u3044\u30b3\u30f3\u30c6\u30ca\u306e\u30bf\u30b0\u3068\u306e\u307f\u4e00\u81f4\u3059\u308b\u3088\u3046\u306bOUTPUT<\/code>\u306eMatch<\/code>\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\u5404\u30b3\u30f3\u30c6\u30ca\u306b\u8a2d\u5b9a\u3055\u308c\u308b\u30bf\u30b0\u306f\u3001\u5b9f\u969b\u306b\u30ed\u30b0\u3092CloudwatchLogs\u306b\u8ee2\u9001\u3057\u305f\u969b\u306e\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u3068\u4e00\u81f4\u3057\u307e\u3059\u3002<\/p>\n
\u4f8b:<\/p>\n
[OUTPUT]\n Name cloudwatch\n Match *demo_main*\n region ap-northeast-1\n log_group_name \/aws\/eks\/fluent-bit-cloudwatch\/main\n[OUTPUT]\n Name cloudwatch\n Match *demo_php*\n region ap-northeast-1\n log_group_name \/aws\/eks\/fluent-bit-cloudwatch\/php<\/code><\/pre>\n\u300c*\u300d\u306f\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u3068\u306a\u308a\u3001\u300c\u4efb\u610f\u306e\u6587\u5b57\u5217\u300d\u3068\u8868\u3057\u307e\u3059\u3002<\/p>\n
[\u88dc\u8db3]\u691c\u8a3c\u624b\u9806<\/h2>\n1. \u691c\u8a3c\u7528\u306eEKS\u30af\u30e9\u30b9\u30bf\u3092\u4f5c\u6210\u3059\u308b<\/h3>\napiVersion: eksctl.io\/v1alpha5\nkind: ClusterConfig\nmetadata:\n name: fluentbit\n region: eu-west-1\n version: '1.20'\niam:\n withOIDC: true\nfargateProfiles:\n - name: defaultfp\n selectors:\n - namespace: demo\n - namespace: kube-system\ncloudWatch:\n clusterLogging:\n enableTypes: ["*"]<\/code><\/pre>\n$ eksctl create cluster -f eks-cluster-config.yaml<\/code><\/pre>\n2. \u691c\u8a3c\u7528\u306eEKS on Fargete\u5b9f\u884c\u30ed\u30fc\u30eb\u306bCloudWatchLogs\u3078\u306e\u66f8\u304d\u8fbc\u307f\u6a29\u9650\u30dd\u30ea\u30b7\u30fc\u3092\u4ed8\u4e0e\u3059\u308b<\/h3>\n$ curl -o permissions.json \\\n https:\/\/raw.githubusercontent.com\/aws-samples\/amazon-eks-fluent-logging-examples\/mainline\/examples\/fargate\/cloudwatchlogs\/permissions.json\n\n$ aws iam create-policy \\\n--policy-name FluentBitEKSFargate \\\n--policy-document file:\/\/permissions.json\n\n$ aws iam attach-role-policy \\\n--policy-arn arn:aws:iam::xxxxxxxxxxx:policy\/FluentBitEKSFargate \\\n--role-name eksctl-fluentbit-cluster-FargatePodExecutionRole-xxxxxxxxxxx<\/code><\/pre>\n3. \u5c02\u7528\u306eaws-observability namespace\u3092apply\u3059\u308b<\/h3>\nkind: Namespace\napiVersion: v1\nmetadata:\n name: aws-observability\n labels:\n aws-observability: enabled<\/code><\/pre>\n$ kubectl apply -f aws-observability-namespace.yaml<\/code><\/pre>\n4. ConfigMap\u3092\u9069\u7528\u3059\u308b<\/h3>\n
\u305d\u308c\u305e\u308c\u306e\u30b3\u30f3\u30c6\u30ca\u306b\u4ed8\u4e0e\u3055\u308c\u308b\u30bf\u30b0\u306b\u5f53\u3066\u306f\u307e\u308b\u3088\u3046\u306bMatch<\/code>\u306e\u5024\u3092\u30bb\u30c3\u30c8\u3057\u307e\u3059\u3002<\/p>\nkind: ConfigMap\napiVersion: v1\nmetadata:\n name: aws-logging\n namespace: aws-observability\n labels:\ndata:\n output.conf: |\n [OUTPUT]\n Name cloudwatch\n Match *demo_main*\n region eu-west-1\n log_group_name \/aws\/eks\/fluent-bit-cloudwatch\/main\n log_stream_prefix from-fluent-bit-\n auto_create_group true\n\n [OUTPUT]\n Name cloudwatch\n Match *demo_php*\n region eu-west-1\n log_group_name \/aws\/eks\/fluent-bit-cloudwatch\/php\n log_stream_prefix from-fluent-bit-\n auto_create_group true<\/code><\/pre>\n$ kubectl apply -f aws-logging-cloudwatch-configmap.yaml<\/code><\/pre>\n5. Deployment\u3092\u9069\u7528\u3059\u308b<\/h3>\n
main<\/code>\u3068php<\/code>\u3068\u3044\u3046\u540d\u524d\u306e2\u3064\u306e\u30b3\u30f3\u30c6\u30ca\u30921\u3064\u306ePod\u5185\u3067\u8d77\u52d5\u3055\u305b\u307e\u3059\u3002<\/p>\napiVersion: apps\/v1\nkind: Deployment\nmetadata:\n name: logger-server\n namespace: demo\nspec:\n selector:\n matchLabels:\n app: nginx\n replicas: 1\n template:\n metadata:\n labels:\n app: nginx\n spec:\n containers:\n - name: main\n image: nginx:1.14.2\n ports:\n - containerPort: 80\n - name: php\n image: php:7.4-fpm\n imagePullPolicy: Always\n ports:\n - containerPort: 9000<\/code><\/pre>\n$ kubectl -n demo apply -f logger-server.yaml && kubectl -n demo expose deploy logger-server<\/code><\/pre>\n6. CloudWatchLogs\u3092\u78ba\u8a8d\u3057\u3066\u3001\u300cphp\u300d\u306e\u30b3\u30f3\u30c6\u30ca\u30ed\u30b0\u304c\u671f\u5f85\u3055\u308c\u305f\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u306b\u51fa\u529b\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n
\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u78ba\u8a8d\u3059\u308b\u3068{namespace}_{\u30b3\u30f3\u30c6\u30ca\u540d}=demo_php<\/code>\u3068\u306a\u3063\u3066\u3044\u308b\u7b87\u6240\u304c\u3042\u308a\u307e\u3059\u3002\u624b\u98064.\u3067\u8a2d\u5b9a\u3057\u305fOUTPUT<\/code>\u306eMatch<\/code>\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u671f\u5f85\u901a\u308a\u30ed\u30b0\u304c\u8ee2\u9001\u3055\u308c\u3066\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u540d: from-fluent-bit-kube.var.log.containers.logger-server-85f45c5d5f-wfwm5_demo_php<\/em><\/strong>-1ce141359cb01b0633b964fbd4a118e7f0a2c877cb645d0bd9d2a1fa09270a0e.log<\/p>\n<\/p>\n
7. \u3082\u3046\u7247\u65b9\u306e\u30b3\u30f3\u30c6\u30ca\u300cmain\u300d\u306e\u30ed\u30b0\u3092\u51fa\u529b\u3055\u305b\u308b<\/h3>\n$ kubectl -n demo port-forward svc\/logger-server 8080:80\n$ curl localhost:8080<\/code><\/pre>\n8. \u3082\u3046\u4e00\u5ea6\u3001CloudWatchLogs\u3092\u78ba\u8a8d\u3057\u3066\u3001\u30b3\u30f3\u30c6\u30ca\u300cmain\u300d\u306e\u30ed\u30b0\u304c\u671f\u5f85\u3055\u308c\u305f\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u306b\u51fa\u529b\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n
\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u78ba\u8a8d\u3059\u308b\u3068{namespace}_{\u30b3\u30f3\u30c6\u30ca\u540d}=demo_main<\/code>\u3068\u306a\u3063\u3066\u3044\u308b\u7b87\u6240\u304c\u3042\u308a\u307e\u3059\u3002\u624b\u98064.\u3067\u8a2d\u5b9a\u3057\u305fOUTPUT<\/code>\u306eMatch<\/code>\u3068\u4e00\u81f4\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u671f\u5f85\u901a\u308a\u30ed\u30b0\u304c\u8ee2\u9001\u3055\u308c\u3066\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u540d: from-fluent-bit-kube.var.log.containers.logger-server-669fb86cf4-vjrsp_demo_main<\/em><\/strong>-cdb04690e593f8a97aa166407a3ff04e876561509b3d213eb76bde5136f52f93.log<\/p>\n<\/p>\n","protected":false},"excerpt":{"rendered":"
\u306f\u3058\u3081\u306b \u524d\u56de\u306e\u8a18\u4e8b\u3067Amazon EKS on Fargate\u4e0a\u306ePod\u30ed\u30b0\u3092CloudWatchLogs\u306b\u9001\u4fe1\u3059\u308b\u3092\u7d39\u4ecb\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002 \u4eca\u56de\u306f\u305d\u306e\u6d3e\u751f\u7248\u3068\u3057\u3066\u3001Pod\u5185\u306b\u8907\u6570\u306e\u30b3\u30f3\u30c6\u30ca\u304c\u8d77\u52d5\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u305d\u308c\u305e\u308c\u306e\u30b3\u30f3\u30c6\u30ca\u30ed\u30b0\u3092\u5225\u3005\u306e\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u306b\u8ee2\u9001\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u305f\u3057\u307e\u3059\u3002 \u5229\u7528\u30b7\u30fc\u30f3 \u4f8b\u3048\u3070\u3001\u76e3\u8996\u76ee\u7684\u3067EKS\u30af\u30e9\u30b9\u30bf\u306bDatadog\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u5c0e\u5165\u3057\u305f\u5834\u5408\u30011\u3064\u306ePod\u5185\u306b\u30a2\u30d7 […]<\/p>\n","protected":false},"author":10,"featured_media":2011,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[408,406],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/1998"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=1998"}],"version-history":[{"count":34,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/1998\/revisions"}],"predecessor-version":[{"id":2050,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/1998\/revisions\/2050"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/2011"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=1998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=1998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=1998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}