{"id":1215,"date":"2021-02-14T23:47:56","date_gmt":"2021-02-14T14:47:56","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/?p=1215"},"modified":"2021-10-29T13:23:50","modified_gmt":"2021-10-29T04:23:50","slug":"best-5ways-searching-cloudwatch-logs","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2021\/02\/14\/best-5ways-searching-cloudwatch-logs\/","title":{"rendered":"CloudWatch Logs \u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3092 tail -f \u3059\u308b5\u3064\u306e\u65b9\u6cd5"},"content":{"rendered":"
\u6700\u8fd1\u3044\u308d\u3044\u308d\u306a\u52c9\u5f37\u3092\u3057\u3066\u3044\u3066\u8133\u306e\u4f53\u529b\u304c\u935b\u3048\u3089\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u6c17\u304c\u3057\u3066\u3044\u307e\u3059\u3002\u3084\u3063\u3055\u3093\u3067\u3059\u3002<\/p>\n
CloudWatch Logs \u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3092tail\u3057\u30ed\u30b0\u51fa\u529b\u60c5\u5831\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u76e3\u8996\u3057\u305f\u3044\u3068\u3044\u3046\u30b1\u30fc\u30b9\u306b\u3064\u3044\u3066\u3001\u4eca\u56de\u306f5\u3064\u306e\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002CLI4\u3064+GUI1\u3064\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n
CloudWatch Logs \u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u306f\u9032\u5316\u3057\u7d9a\u3051\u3066\u3044\u307e\u3059\u304c\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u76e3\u8996\u3068\u3044\u3046\u8981\u4ef6\u306b\u304a\u3044\u3066\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u304b\u3089\u30ed\u30b0\u76e3\u8996\u3092\u884c\u3044\u305f\u3044\u30b1\u30fc\u30b9\u306f\u983b\u7e41\u306b\u767a\u751f\u3057\u307e\u3059\u3002CLI\u3067\u30ed\u30b0\u76e3\u8996\u3059\u308b\u3068\u3001\u4f7f\u3044\u6163\u308c\u305f\u30d1\u30a4\u30d7\u3084grep\u306a\u3069\u306eLinux\u30b3\u30de\u30f3\u30c9\u3092\u5229\u7528\u3067\u304d\u308b\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u3066\u30ed\u30b0\u51fa\u529b\u60c5\u5831\u3092\u4fdd\u5b58\u3059\u308b\u306a\u3069\u69d8\u3005\u306a\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
AWS CLI V2\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001CloudWatch Logs \u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3092tail\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n
aws logs tail \\\n\u3010\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u540d\u3011 \\\n--follow<\/code><\/pre>\n\u51fa\u529b\u4f8b<\/h4>\n
<\/a><\/p>\nPros<\/h4>\n\n- AWS\u306e\u516c\u5f0f\u30c4\u30fc\u30eb\u3068\u3044\u3046\u5b89\u5fc3\u611f<\/li>\n
- \u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\u30fc\u306b\u3088\u308b\u7c21\u5358\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n
- AWS CLI V2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308c\u3070\u3059\u3050\u306b\u4f7f\u3044\u59cb\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/li>\n<\/ul>\n
Cons<\/h4>\n\n- \u4ed6\u3068\u6bd4\u8f03\u3057\u3066\u3001\u6a5f\u80fd\u3068\u3057\u3066\u306f\u5c11\u306a\u3081<\/li>\n
- \u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u3092\u6307\u5b9a\u3067\u304d\u306a\u3044<\/li>\n
- \u65e5\u6642\u3084\u6642\u523b\u306b\u3088\u308b\u7bc4\u56f2\u6307\u5b9a\u304c\u3067\u304d\u306a\u3044<\/li>\n<\/ul>\n
2 \u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u300cawslogs\u300d\u306e\u300c-w\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u5229\u7528\u3059\u308b<\/h3>\n
awslogs\u306f\u3001Amazon CloudWatch\u306e\u30ed\u30b0\u304b\u3089\u30b0\u30eb\u30fc\u30d7\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u3001\u30a4\u30d9\u30f3\u30c8\u3092\u30af\u30a8\u30ea\u3059\u308b\u305f\u3081\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/p>\n
\u30b3\u30de\u30f3\u30c9\u4f8b<\/h4>\nawslogs get \\\n\u3010\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u540d\u3011 \\\n-w<\/code><\/pre>\n\u51fa\u529b\u4f8b<\/h4>\n
<\/a><\/p>\nPros<\/h4>\n\n- brew\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u7c21\u5358\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n
- \u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3084\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u691c\u7d22\u30b3\u30de\u30f3\u30c9\u3082\u3042\u308b<\/li>\n
- \u6b63\u898f\u8868\u73fe\u306b\u3088\u308b\u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u6a5f\u80fd<\/li>\n
- \u985e\u4f3c\u7cfb\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u5143\u7956\u7684\u306a\u5b58\u5728\u3067\u3001\u4eba\u6c17\u304c\u9ad8\u3044<\/li>\n<\/ul>\n
Cons<\/h4>\n\n- \u5f8c\u767a\u7cfb\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3068\u6bd4\u8f03\u3057\u3066\u52d5\u4f5c\u901f\u5ea6\u304c\u82e5\u5e72\u9045\u3044<\/li>\n
- \u8907\u6570\u306e\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u6307\u5b9a\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044<\/li>\n<\/ul>\n
3 \u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u300ccw\u300d\u306e\u300ctail -f\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u5229\u7528\u3059\u308b \u3010\u30aa\u30b9\u30b9\u30e1\uff01\u3011<\/h3>\n
<\/a>
\ncw\u306fgo\u3067\u4f5c\u3089\u308c\u3066\u304a\u308a\u3001\u8907\u6570\u306e\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u6307\u5b9a\u304c\u3067\u304d\u9ad8\u901f\u306b\u52d5\u4f5c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/p>\n\u30b3\u30de\u30f3\u30c9\u4f8b<\/h4>\ncw tail -f \\\n\u3010\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u540d\u3011<\/code><\/pre>\n\u51fa\u529b\u4f8b<\/h4>\n
<\/a><\/p>\nPros<\/h4>\n\n- brew\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u7c21\u5358\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n
- \u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3084\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u691c\u7d22\u30b3\u30de\u30f3\u30c9\u3082\u3042\u308b<\/li>\n
- \u8907\u6570\u306e\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u6307\u5b9a\u304c\u53ef\u80fd<\/li>\n
- \u6b63\u898f\u8868\u73fe\u306b\u3088\u308b\u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u6a5f\u80fd<\/li>\n
- \u9ad8\u901f\u306b\u52d5\u4f5c\u3059\u308b<\/li>\n<\/ul>\n
Cons<\/h4>\n\n- \u8907\u6570\u306e\u30b0\u30eb\u30fc\u30d7\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\u306b\u3001\u6b63\u898f\u8868\u73fe\u304c\u4f7f\u3048\u306a\u3044\u305f\u3081\u5197\u9577\u306b\u306a\u308a\u304c\u3061<\/li>\n<\/ul>\n
4 \u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u300cutern\u300d\u3092\u5229\u7528\u3059\u308b \u3010\u30aa\u30b9\u30b9\u30e1\uff01\u3011<\/h3>\n
<\/a>
\nUtern\u3067\u306f\u3001AWS CloudWatch Logs\u4e0a\u306e\u8907\u6570\u306e\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u3084\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089\u30ed\u30b0\u30a4\u30d9\u30f3\u30c8\u3092\u5c3e\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\u30b3\u30de\u30f3\u30c9\u4f8b<\/h4>\nutern \\\n\u3010\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u540d\u3011<\/code><\/pre>\n\u51fa\u529b\u4f8b<\/h4>\n
<\/a><\/p>\nPros<\/h4>\n\n- brew\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u7c21\u5358\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n
- \u6b63\u898f\u8868\u73fe\u306b\u3088\u308b\u5f37\u529b\u306a\u30b0\u30eb\u30fc\u30d7\u540d\u30fb\u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u6a5f\u80fd<\/li>\n
- \u9ad8\u901f\u306b\u52d5\u4f5c\u3059\u308b<\/li>\n<\/ul>\n
Cons<\/h4>\n\n- \u30b0\u30eb\u30fc\u30d7\u540d\u3084\u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u306b\u6b63\u898f\u8868\u73fe\u3092\u5229\u7528\u3067\u304d\u308b\u306e\u306f\u826f\u3044\u304c\u3001\u5143\u3068\u306a\u308b\u30b0\u30eb\u30fc\u30d7\u540d\u3084\u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u306e\u547d\u540d\u898f\u5247\u304c\u30eb\u30fc\u30eb\u5316\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0<\/li>\n<\/ul>\n
5 JetBrains\u306eIDE\u30d7\u30e9\u30b0\u30a4\u30f3\u300cAWS Toolkit for JetBrains\u300d\u3092\u5229\u7528\u3059\u308b<\/h3>\n
AWS Toolkit for JetBrains\u306f\u3001AWS\u4e0a\u3067\u69cb\u7bc9\u3055\u308c\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u8a18\u8ff0\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308bJetBrains IDE\u7528\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u3001CloudWatch\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u8868\u793a\u3068\u691c\u7d22\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n
\u753b\u9762\u30b5\u30f3\u30d7\u30eb<\/h4>\n
<\/a><\/p>\nPros<\/h4>\n\n- GUI\u3067\u304a\u624b\u8efd\u306b\u30ed\u30b0\u60c5\u5831\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u76e3\u8996\u3067\u304d\u308b<\/li>\n<\/ul>\n
Cons<\/h4>\n\n- IDE\u304c\u6709\u6599\u3067\u3042\u308b<\/li>\n
- logs\u3060\u3051\u3067\u306a\u304f\u3001Lambda\u306a\u3069AWS\u30ea\u30bd\u30fc\u30b9\u306e\u76f4\u63a5\u66f4\u65b0\u3084\u524a\u9664\u304c\u53ef\u80fd\u306a\u306e\u3067\u3001\u6ce8\u610f\u3092\u6255\u3063\u3066\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308b<\/li>\n
- \u4ed6\u3068\u6bd4\u8f03\u3057\u3066\u3001\u6a5f\u80fd\u3068\u3057\u3066\u306f\u5c11\u306a\u3081<\/li>\n
- \u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u76e3\u8996\u6642\u306b\u521d\u56de\u306e\u307f\u753b\u9762\u3092\u30b9\u30af\u30ed\u30fc\u30eb\u3055\u305b\u3066\u8ffd\u5f93\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f<\/li>\n<\/ul>\n
\u6bd4\u8f03\u8868<\/h2>\n
\u305d\u308c\u305e\u308c\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u7c21\u6613\u7684\u306a\u6bd4\u8f03\u3092\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n