{"id":29635,"date":"2025-11-14T12:54:11","date_gmt":"2025-11-14T03:54:11","guid":{"rendered":"https:\/\/www.skyarch.net\/blog\/?p=29635"},"modified":"2025-11-14T12:54:11","modified_gmt":"2025-11-14T03:54:11","slug":"cloudtrail%e3%81%ae%e3%83%ad%e3%82%b0%e3%82%92athena%e3%81%8b%e3%82%89%e3%82%af%e3%82%a8%e3%83%aa%e3%81%99%e3%82%8b%e9%9a%9b%e3%81%ab%e3%83%8f%e3%83%9e%e3%81%a3%e3%81%9f","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/cloudtrail%e3%81%ae%e3%83%ad%e3%82%b0%e3%82%92athena%e3%81%8b%e3%82%89%e3%82%af%e3%82%a8%e3%83%aa%e3%81%99%e3%82%8b%e9%9a%9b%e3%81%ab%e3%83%8f%e3%83%9e%e3%81%a3%e3%81%9f\/","title":{"rendered":"CloudTrail\u306e\u30ed\u30b0\u3092Athena\u304b\u3089\u30af\u30a8\u30ea\u3059\u308b\u969b\u306b\u30cf\u30de\u3063\u305f"},"content":{"rendered":"<h1>\u306f\u3058\u3081\u306b<\/h1>\n<p>\u3053\u3093\u306b\u3061\u306f\u3002\u305f\u306e\u3057\u3044Athena\u30e9\u30a4\u30d5\u3001\u9001\u3063\u3066\u307e\u3059\u304b\uff1f<br \/>\nCloudTrail\u306e\u8a3c\u8de1\u30ed\u30b0\u3092Athena\u304b\u3089SQL\u3067\u5206\u6790\u3059\u308b\u7528\u4e8b\u304c\u3042\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u969b\u306b\u30bf\u30a4\u30c8\u30eb\u306e\u4ef6\u3067\u30d7\u30c1\u30cf\u30de\u308a\u3057\u305f\u306e\u3067\u8a18\u9332\u306b\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h1>\u5148\u306b\u7d50\u8ad6<\/h1>\n<p>\u5148\u306b\u7d50\u8ad6\u3092\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>CloudTrail\u30ed\u30b0\u691c\u7d22\u7528\u306eGlue\u30c6\u30fc\u30d6\u30eb\u3067\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u69cb\u6210\u3092\u6709\u52b9\u5316\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u7ba1\u7406\u306f\u8003\u616e\u304c\u5fc5\u8981\u3067\u3059\u3002\n<ul>\n<li><code>MSCK REPAIR TABLE<\/code>\u306b\u3088\u308b\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u81ea\u52d5\u691c\u51fa\u30fb\u4fee\u5fa9\u306f\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002<\/li>\n<li>\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u3059\u308b\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u8ffd\u52a0\u306f<code>ALTER TABLE ADD PARTITION<\/code>\u3067\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/li>\n<li><code>MSCK REPAIR TABLE<\/code>\u3067\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u66f4\u65b0\u304c\u3067\u304d\u308b\u306e\u306fHive\u5f62\u5f0f\u3067\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306e\u307f\u3067\u3059\u3002<\/li>\n<li>Hive\u5f62\u5f0f\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3068\u306f\u3001S3\u4e0a\u3067\u306e\u30d1\u30b9(\u76f8\u5f53\u306e\u90e8\u5206)\u304c<code>Field1=Value1\/<\/code>\u306e\u5f62\u5f0f\u3067\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u72b6\u614b\u3092\u6307\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<h1>\u304d\u3063\u304b\u3051<\/h1>\n<p>\u305d\u3082\u305d\u3082\u306e\u304d\u3063\u304b\u3051\u306f\u3001S3\u306b\u51fa\u529b\u3055\u308c\u305fCloudTrail\u306e\u8a3c\u8de1\u30ed\u30b0\u304b\u3089\u5fc5\u8981\u306a\u3082\u306e\u3092\u62bd\u51fa\u3057\u3066\u5b9a\u671f\u7684\u306b\u51fa\u529b\u3059\u308b\u7528\u4e8b\u304c\u3042\u3063\u305f\u305f\u3081\u3067\u3057\u305f\u3002<br \/>\nCloudTrail\u306f\u3001\u8a3c\u8de1\u30ed\u30b0\u3092S3\u30d0\u30b1\u30c3\u30c8\u306b\u51fa\u529b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u305d\u306e\u969b\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea(\u6b63\u78ba\u306b\u306f\u30ad\u30fc\u306e\u4e00\u90e8\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u4fbf\u5b9c\u4e0a\u672c\u7a3f\u3067\u306f\u305d\u3046\u547c\u3093\u3067\u304a\u304d\u307e\u3059)\u69cb\u6210\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u306e\u8aac\u660e\u306b\u3064\u3044\u3066\u306f<a href=\"https:\/\/docs.aws.amazon.com\/awscloudtrail\/latest\/userguide\/get-and-view-cloudtrail-log-files.html\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u304c\u8a73\u3057\u3044\u306e\u3067\u305d\u3061\u3089\u306b\u8b72\u3063\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<blockquote>\n<p><code>PATH\/TO\/PREFIX\/AWSLogs\/ACCOUNTNUMBER\/CloudTrail\/REGION\/YYYY\/MM\/DD\/<\/code><\/p>\n<\/blockquote>\n<p>\u3053\u306e\u6642\u306f\u307e\u3060\u3001\u300c\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u304c\u5897\u3048\u3066\u3082<code>MSCK REPAIR TABLE<\/code>\u3059\u308c\u3070\u304a\u624b\u8efd\u306b\u3067\u304d\u305d\u3046\u300d\u3068\u8003\u3048\u3066\u3044\u307e\u3057\u305f\u2026\u3002<\/p>\n<h1>\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u66f4\u65b0\u3067\u30cf\u30de\u308b<\/h1>\n<p>CloudTrail\u306e\u8a3c\u8de1\u30ed\u30b0\u3092Athena\u304b\u3089SQL\u3067\u691c\u7d22\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u306b\u306f\u3001\u4e0b\u6e96\u5099\u3068\u3057\u3066\u3001\u8a3c\u8de1\u30ed\u30b0\u3092\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u3068\u3059\u308bGlue\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Athena\u306f\u30c7\u30fc\u30bf\u306e\u30b9\u30ad\u30e3\u30f3\u91cf\u306b\u6bd4\u4f8b\u3057\u305f\u8ab2\u91d1\u4f53\u7cfb\u306e\u305f\u3081\u3001\u30b9\u30ad\u30e3\u30f3\u91cf\u3092\u5c11\u306a\u304f\u3059\u308b\u306b\u306f\u3001\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u5316\u306b\u3088\u308b\u30b9\u30ad\u30e3\u30f3\u7bc4\u56f2\u306e\u7d5e\u308a\u8fbc\u307f\u304c\u6709\u52b9\u3067\u3059\u3002<a href=\"https:\/\/docs.aws.amazon.com\/athena\/latest\/ug\/create-cloudtrail-table.html\">\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u6709\u52b9\u306b\u3057\u305fGlue\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210\u624b\u9806<\/a>\u3092\u53c2\u8003\u306b\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<a href=\"https:\/\/docs.aws.amazon.com\/athena\/latest\/ug\/create-cloudtrail-table-ct.html\">\u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u30a4\u30d9\u30f3\u30c8\u5c65\u6b74\u304b\u3089\u4f5c\u6210\u3059\u308b\u624b\u9806<\/a>\u3067\u306f\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u69cb\u6210\u304c\u542b\u307e\u308c\u306a\u3044\u30c6\u30fc\u30d6\u30eb\u306b\u306a\u308b\u305f\u3081\u6c17\u3092\u4ed8\u3051\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4e0b\u3054\u3057\u3089\u3048\u304c\u3067\u304d\u305f\u3068\u3053\u308d\u3067\u3001<code>MSCK REPAIR TABLE<\/code>\u306b\u3088\u308a\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u66f4\u65b0\u3057\u307e\u3059\u3002<br \/>\n\u3057\u307e\u3059\u3002<br \/>\n\u3057\u307e\u3059\u2026\u3002<\/p>\n<p>\u3042\u308c\uff1f\u4f55\u3082\u51fa\u306a\u3044\u305e\uff1f\u30d5\u30a1\u30a4\u30eb\u3082\u78ba\u304b\u306b\u914d\u7f6e\u3057\u305f\u306e\u306b\u2026\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/11\/msck-repair-table-nonhive.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/11\/msck-repair-table-nonhive.png\" alt=\"\" \/><\/a>\n<p>\u5b9f\u969b\u3001<code>SHOW PARTITIONS<\/code>\u3067\u898b\u3066\u307f\u3066\u3082\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306f\u5897\u3048\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/11\/show-partitions-nonhive.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/11\/show-partitions-nonhive.png\" alt=\"\" \/><\/a>\n<h1>\u539f\u56e0<\/h1>\n<p><code>MSCK REPAIR TABLE<\/code>\u3092\u5b9f\u884c\u3057\u3066\u3082\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u304c\u5897\u3048\u306a\u304b\u3063\u305f\u539f\u56e0\u306f\u3061\u3083\u3093\u3068\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u66f8\u3044\u3066\u3042\u308a\u307e\u3057\u305f\u2026\u3002<\/p>\n<blockquote>\n<p>Hive \u3068\u4e92\u63db\u6027\u306e\u306a\u3044\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u5834\u5408\u3001<code>ALTER TABLE ADD PARTITION<\/code> \u3092\u4f7f\u7528\u3057\u3066\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u3092\u30af\u30a8\u30ea\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<\/blockquote>\n<p>\u3053\u3053\u307e\u3067\u6765\u3066\u306f\u3058\u3081\u3066\u3001\u6539\u3081\u3066\u300cHive\u5f62\u5f0f\u300d\u306b\u3064\u3044\u3066\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002\u3064\u307e\u308b\u3068\u3053\u308d\u3001Hive\u5f62\u5f0f\u3068\u306f\u3001\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306b\u8a72\u5f53\u3059\u308b\u90e8\u5206\u306eS3\u30ad\u30fc\u304c<code>Field1=Value1\/<\/code>\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u306a\u3063\u3066\u3044\u308b\u4fdd\u5b58\u5f62\u614b\u3092\u6307\u3059\u3068\u306e\u3053\u3068\u3067\u3059\uff08<a href=\"https:\/\/docs.aws.amazon.com\/athena\/latest\/ug\/partitions.html\">\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\uff09\u3002CloudTrail\u304c\u51fa\u529b\u3059\u308b\u8a3c\u8de1\u30ed\u30b0\u306fHive\u5f62\u5f0f\u3058\u3083\u306a\u304b\u3063\u305f\u3093\u3067\u3059\u306d\u2026\u3002<\/p>\n<h1>\u5bfe\u5fdc<\/h1>\n<p>\u539f\u56e0\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u5bfe\u51e6\u3082\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<code>ALTER TABLE ADD PARTITIONS<\/code>\u3067\u30b3\u30c4\u30b3\u30c4\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304f\u3060\u3051\u3067\u3059\u306d\u3002<code>PARTITIONS (partition-set)<\/code>\u306e\u90e8\u5206\u306f\u7e70\u308a\u8fd4\u3057\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u8907\u6570\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u304c\u3042\u308b\u5834\u5408\u3082\u307e\u3068\u3081\u3066\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002<br \/>\n\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u304c\u6b63\u3057\u304f\u767b\u9332\u3055\u308c\u3066\u3044\u308c\u3070\u3001<code>SHOW PARTITIONS<\/code>\u304b\u3089\u3082\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<a href=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/11\/alter-table-add-partitions.png\"><img decoding=\"async\" src=\"https:\/\/www.skyarch.net\/blog\/wp-content\/uploads\/2025\/11\/alter-table-add-partitions.png\" alt=\"\" \/><\/a>\n<h1>\u307e\u3068\u3081<\/h1>\n<p>AWS\u3092\u6d3b\u7528\u3059\u308c\u3070\u3059\u308b\u307b\u3069CloudTrail\u306e\u30ed\u30b0\u3082\u5927\u91cf\u306b\u51fa\u529b\u3055\u308c\u308b\u305f\u3081\u3001Athena\u304b\u3089\u306e\u30af\u30a8\u30ea\u306b\u304a\u3044\u3066\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u306f\u3001\u30b3\u30b9\u30c8\u52b9\u7387\u306e\u9762\u304b\u3089\u3059\u308b\u3068\u30de\u30b9\u30c8\u3068\u3044\u3063\u3066\u3044\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<ul>\n<li>AWS CloudTrail\u304c\u51fa\u529b\u3059\u308b\u8a3c\u8de1\u306e\u4fdd\u5b58\u5f62\u5f0f\u306fHive\u5f62\u5f0f\u3067\u306f\u306a\u3044<\/li>\n<li>\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u5316\u3055\u308c\u305f\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u3066Amazon Athena\u304b\u3089\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3059\u308b\u5834\u5408\u306f<code>ALTER TABLE ADD PARTITION<\/code>\u3067\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<\/li>\n<\/ul>\n<p>\u3068\u306f\u3044\u3048\u3001\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u3088\u3063\u3066\u3001Hive\u5f62\u5f0f\u3067\u3042\u3063\u3066\u307b\u3057\u3044\u5834\u5408\u3068\u305d\u3046\u3058\u3083\u306a\u3044\u307b\u3046\u304c\u3044\u3044\u5834\u5408\u3068\u4e21\u65b9\u3042\u308b\u306e\u3067\u60a9\u307e\u3057\u3044\u3067\u3059\u306d\u2026\u3002<br \/>\n\u305d\u308c\u3067\u306f\u307e\u305f\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b \u3053\u3093\u306b\u3061\u306f\u3002\u305f\u306e\u3057\u3044Athena\u30e9\u30a4\u30d5\u3001\u9001\u3063\u3066\u307e\u3059\u304b\uff1f CloudTrail\u306e\u8a3c\u8de1\u30ed\u30b0\u3092Athena\u304b\u3089SQL\u3067\u5206\u6790\u3059\u308b\u7528\u4e8b\u304c\u3042\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u969b\u306b\u30bf\u30a4\u30c8\u30eb\u306e\u4ef6\u3067\u30d7\u30c1\u30cf\u30de\u308a\u3057\u305f\u306e\u3067\u8a18\u9332\u306b\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002 \u5148\u306b&#8230;<\/p>\n","protected":false},"author":205,"featured_media":29641,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/www.skyarch.net\/blog\/?p=29635","footnotes":""},"categories":[1192,20],"tags":[],"class_list":{"0":"post-29635","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-athena","8":"category-aws","9":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/29635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/205"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=29635"}],"version-history":[{"count":3,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/29635\/revisions"}],"predecessor-version":[{"id":29643,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/29635\/revisions\/29643"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/29641"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=29635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=29635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=29635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}