{"id":1065,"date":"2023-02-28T09:00:00","date_gmt":"2023-02-28T00:00:00","guid":{"rendered":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/?p=1065"},"modified":"2023-03-20T12:40:47","modified_gmt":"2023-03-20T03:40:47","slug":"gcp%e3%81%a7%e3%83%90%e3%83%bc%e3%82%b9%e3%83%88%e3%82%a2%e3%82%af%e3%82%bb%e3%82%b9%e3%82%92%e5%88%86%e6%9e%90%e3%82%92%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/1065\/","title":{"rendered":"GCP\u3067\u30d0\u30fc\u30b9\u30c8\u30a2\u30af\u30bb\u30b9\u3092\u5206\u6790\u3092\u3057\u3066\u307f\u305f"},"content":{"rendered":"\n<p>\u3053\u3093\u306b\u3061\u306f\u3002<span style=\"border-bottom: solid 3px #4169e1\">\u904b\u7528\u958b\u767a\u30b0\u30eb\u30fc\u30d7\u306e\u9ad8\u6a4b<\/span>\u3067\u3059\u3002<br>\u672c\u8a18\u4e8b\u3067\u306f\u3001\u5f0a\u793eWeb\u30b5\u30fc\u30d3\u30b9\u306b\u5bfe\u3057\u3066\u5b9a\u671f\u7684\u306b\u767a\u751f\u3059\u308b\u30d0\u30fc\u30b9\u30c8\u30a2\u30af\u30bb\u30b9\u3092\u7c21\u6613\u7684\u306b\u5206\u6790\u3057\u3066\u307f\u305f\u4e8b\u4f8b\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u69cb\u6210<\/h2>\n\n\n\n<p>\u7c21\u6613\u7684\u306a\u69cb\u6210\u56f3\u3067\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br>\u30ed\u30b0\u5206\u6790\u306b\u95a2\u9023\u3059\u308b\u90e8\u5206\u306e\u307f\u8efd\u304f\u89e6\u308c\u308b\u3068\u3001\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306b Google Cloud Load Balancing (GCLB) \u3092\u914d\u7f6e\u3057\u3066\u304a\u308a\u3001GCLB \u306e\u30ed\u30b0\u306f Cloud Logging \u3092\u7d4c\u7531\u3057\u3066 BigQuery \u306b\u84c4\u7a4d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"669\" src=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/eaea6cc56280fc8b59a73872c4742300-1024x669.png\" alt=\"\" class=\"wp-image-1068\" srcset=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/eaea6cc56280fc8b59a73872c4742300-1024x669.png 1024w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/eaea6cc56280fc8b59a73872c4742300-300x196.png 300w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/eaea6cc56280fc8b59a73872c4742300-768x502.png 768w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/eaea6cc56280fc8b59a73872c4742300-1536x1004.png 1536w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/eaea6cc56280fc8b59a73872c4742300-2048x1338.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5206\u6790\u3057\u3066\u307f\u305f<\/h2>\n\n\n\n<p>\u5206\u6790\u5bfe\u8c61\u306e\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9\u306f GCLB \u306e\u30e1\u30c8\u30ea\u30af\u30b9\u3068\u30ed\u30b0\u3068\u306a\u308a\u3001\u5206\u6790\u306f\u4ee5\u4e0b\u306e3\u30b9\u30c6\u30c3\u30d7\u3067\u9032\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u30d0\u30fc\u30b9\u30c8\u767a\u751f\u6642\u9593\u5e2f\u306e\u78ba\u8a8d (Cloud Monitoring)<\/li>\n\n\n\n<li>\u30d0\u30fc\u30b9\u30c8\u767a\u751f\u6642\u9593\u5e2f\u306b\u304a\u3051\u308b\u4e0a\u4f4d\u30a2\u30af\u30bb\u30b9\u5143IP\u30a2\u30c9\u30ec\u30b9\u306e\u7279\u5b9a (BigQuery)<\/li>\n\n\n\n<li>\u4e0a\u4f4d\u30a2\u30af\u30bb\u30b9\u5143IP\u30a2\u30c9\u30ec\u30b9\u306e\u8abf\u67fb<\/li>\n<\/ol>\n\n\n\n<h1 class=\"wp-block-heading\">\u30d0\u30fc\u30b9\u30c8\u767a\u751f\u6642\u9593\u5e2f\u306e\u78ba\u8a8d<\/h1>\n\n\n\n<p>Cloud Monitoring \u306e Metrics Explorer \u3092\u4f7f\u3063\u3066\u3001\u30d0\u30fc\u30b9\u30c8\u30a2\u30af\u30bb\u30b9\u306e\u767a\u751f\u72b6\u6cc1\u3092\u78ba\u8a8d\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br>\u6307\u6a19\u3092\u9078\u629e\u3059\u308b\u753b\u9762\u304b\u3089 Google Cloud HTTP\/S Load Balancing Rule &gt; https &gt; Request count \u3092\u9078\u629e\u3057\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u6570\u306e\u63a8\u79fb\u304b\u3089\u30d0\u30fc\u30b9\u30c8\u30a2\u30af\u30bb\u30b9\u306e\u767a\u751f\u6642\u9593\u5e2f\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u56f3\u306f GCLB \u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u6570\u306e\u63a8\u79fb\u3092\u30a2\u30af\u30bb\u30b9\u5143\u306e\u56fd\u60c5\u5831\u3092\u3082\u3068\u306b\u30b0\u30eb\u30fc\u30d4\u30f3\u30b0\u3057\u305f\u30b0\u30e9\u30d5\u3068\u306a\u308a\u307e\u3059\u3002<br>\u3053\u306e\u30b0\u30e9\u30d5\u304b\u3089\u3001US\u304b\u3089\u306e\u30d0\u30fc\u30b9\u30c8\u30a2\u30af\u30bb\u30b9\u304c16:30-16:40\u306e\u9593\u3067\u767a\u751f\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"244\" src=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/474261429d93caf19812a4ed7dea7369.png\" alt=\"\" class=\"wp-image-1076\" srcset=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/474261429d93caf19812a4ed7dea7369.png 602w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/474261429d93caf19812a4ed7dea7369-300x122.png 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u30d0\u30fc\u30b9\u30c8\u767a\u751f\u6642\u9593\u5e2f\u306b\u304a\u3051\u308b\u4e0a\u4f4d\u30a2\u30af\u30bb\u30b9\u5143IP\u30a2\u30c9\u30ec\u30b9\u306e\u7279\u5b9a<\/h1>\n\n\n\n<p>BigQuery \u3067\u30af\u30a8\u30ea\u3092\u767a\u884c\u3057\u3001\u30d0\u30fc\u30b9\u30c8\u30a2\u30af\u30bb\u30b9\u306e\u767a\u751f\u6642\u9593\u5e2f\u306b\u304a\u3044\u3066\u3001\u3069\u306e\u3088\u3046\u306aIP\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u591a\u91cf\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u6765\u3066\u3044\u308b\u306e\u304b\u3092\u78ba\u8a8d\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u524d\u63d0\u3068\u3057\u3066\u3001GCLB \u306e\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3057\u3066\u3044\u308b\u30c6\u30fc\u30d6\u30eb\u306f\u65e5\u5358\u4f4d\u306e<a href=\"https:\/\/cloud.google.com\/bigquery\/docs\/partitioned-tables?hl=ja\" title=\"\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u5206\u5272\u30c6\u30fc\u30d6\u30eb\">\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u5206\u5272\u30c6\u30fc\u30d6\u30eb<\/a>\u3068\u3057\u3066\u304a\u308a\u3001\u30af\u30a8\u30ea\u3082\u5bfe\u8c61\u65e5\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306b\u5bfe\u3057\u3066\u767a\u884c\u3057\u3066\u3044\u307e\u3059\u3002<br>\u753b\u50cf\u3067\u306f\u30de\u30b9\u30ad\u30f3\u30b0\u3057\u3066\u304a\u308a\u307e\u3059\u304c\u3001\u30af\u30a8\u30ea\u306e\u5b9f\u884c\u7d50\u679c\u304b\u3089\u30d0\u30fc\u30b9\u30c8\u767a\u751f\u6642\u9593\u5e2f\u306b\u304a\u3051\u308b\u30a2\u30af\u30bb\u30b9\u5143IP\u30a2\u30c9\u30ec\u30b9\u306e\u4e0a\u4f4d\u3092\u7279\u5b9a\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># {}\u5185\u306f\u5b9f\u884c\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u8981\u5909\u66f4\nSELECT&nbsp;httpRequest.remoteIp,count(httpRequest.remoteIp) as CNT,\nFROM&nbsp;`{\u30c6\u30fc\u30d6\u30ebID}`\nWHERE&nbsp;DATE(timestamp)&nbsp;=&nbsp;\"{\u5bfe\u8c61\u65e5\u4ed8}\"&nbsp;AND&nbsp;FORMAT_TIMESTAMP('%Y-%m-%d&nbsp;%H:%M:%S',&nbsp;timestamp,&nbsp;'Asia\/Tokyo')&nbsp;between&nbsp;'{\u30d0\u30fc\u30b9\u30c8\u958b\u59cb\u6642\u523b}'&nbsp;and&nbsp;'{\u30d0\u30fc\u30b9\u30c8\u7d42\u4e86\u6642\u523b}'\nGroup by &nbsp;httpRequest.remoteIp\nORDER BY CNT DESC<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"511\" src=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/20b9bb2701b34a82b45376cc7ba8a0fd-1-1024x511.png\" alt=\"\" class=\"wp-image-1085\" srcset=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/20b9bb2701b34a82b45376cc7ba8a0fd-1-1024x511.png 1024w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/20b9bb2701b34a82b45376cc7ba8a0fd-1-300x150.png 300w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/20b9bb2701b34a82b45376cc7ba8a0fd-1-768x383.png 768w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/20b9bb2701b34a82b45376cc7ba8a0fd-1-1536x767.png 1536w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/20b9bb2701b34a82b45376cc7ba8a0fd-1-2048x1023.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e0a\u4f4d\u30a2\u30af\u30bb\u30b9\u5143IP\u30a2\u30c9\u30ec\u30b9\u306e\u8abf\u67fb<\/h1>\n\n\n\n<p>\u30d0\u30fc\u30b9\u30c8\u767a\u751f\u6642\u9593\u5e2f\u306e\u4e0a\u4f4d\u30a2\u30af\u30bb\u30b9\u5143IP\u30a2\u30c9\u30ec\u30b9\u306b\u3064\u3044\u3066\u8abf\u67fb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br>\u4eca\u56de\u306fGoogle\u5098\u4e0b\u3067\u904b\u55b6\u3055\u308c\u3066\u3044\u308b <a href=\"https:\/\/www.virustotal.com\/gui\/home\/search\" title=\"VirusTotal\">VirusTotal<\/a> \u3068\u3044\u3046\u7121\u6599\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30c4\u30fc\u30eb\u3092\u5229\u7528\u3057\u307e\u3057\u305f\u3002VirusTotal \u3067\u306f\u30d5\u30a1\u30a4\u30eb\u3084\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306e\u30de\u30eb\u30a6\u30a7\u30a2\u691c\u67fb\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u3001\u4eca\u56de\u306fIP\u30a2\u30c9\u30ec\u30b9\u3092\u3082\u3068\u306b\u691c\u67fb\u3092\u884c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"838\" height=\"717\" src=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-top.png\" alt=\"\" class=\"wp-image-1091\" srcset=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-top.png 838w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-top-300x257.png 300w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-top-768x657.png 768w\" sizes=\"(max-width: 838px) 100vw, 838px\" \/><\/figure>\n\n\n\n<p>\u4e0a\u4f4d\u30a2\u30af\u30bb\u30b9\u5143IP\u30a2\u30c9\u30ec\u30b9\u3092\u691c\u67fb\u3057\u3066\u307f\u305f\u7d50\u679c\u3068\u306a\u308a\u307e\u3059\u3002\u8907\u6570\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30f3\u30c0\u30fc\u304c\u60aa\u610f\u304c\u3042\u308b\u3068\u3044\u3046\u5224\u5b9a\u3092\u3057\u3066\u304a\u308a\u3001\u653b\u6483\u8005\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3092\u53d7\u3051\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"632\" src=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-result-1024x632.png\" alt=\"\" class=\"wp-image-1092\" srcset=\"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-result-1024x632.png 1024w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-result-300x185.png 300w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-result-768x474.png 768w, https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-content\/uploads\/2023\/02\/virustotal-result.png 1326w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4eca\u5f8c\u306e\u30a2\u30af\u30bb\u30b9\u50be\u5411\u3082\u898b\u306a\u304c\u3089\u3001\u3053\u3046\u3057\u305f\u60c5\u5831\u3092\u3082\u3068\u306bIP\u30a2\u30c9\u30ec\u30b9\u5236\u9650\u306a\u3069\u306e\u5bfe\u7b56\u3092\u884c\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u3053\u3093\u306b\u3061\u306f\u3002\u904b\u7528\u958b\u767a\u30b0\u30eb\u30fc\u30d7\u306e\u9ad8\u6a4b\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001\u5f0a\u793eWeb\u30b5\u30fc\u30d3\u30b9\u306b\u5bfe\u3057\u3066\u5b9a\u671f\u7684\u306b\u767a\u751f\u3059\u308b\u30d0\u30fc\u30b9\u30c8\u30a2\u30af\u30bb\u30b9\u3092\u7c21\u6613\u7684\u306b\u5206\u6790\u3057\u3066\u307f\u305f\u4e8b\u4f8b\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u69cb\u6210 \u7c21\u6613\u7684\u306a\u69cb\u6210\u56f3\u3067\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u30ed\u30b0\u5206\u6790\u306b\u95a2\u9023 [&hellip;]","protected":false},"author":16,"featured_media":101,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[1],"tags":[22],"class_list":["post-1065","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-categry-cloud","tag-gcp"],"_links":{"self":[{"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/posts\/1065"}],"collection":[{"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/comments?post=1065"}],"version-history":[{"count":28,"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/posts\/1065\/revisions"}],"predecessor-version":[{"id":1124,"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/posts\/1065\/revisions\/1124"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/media\/101"}],"wp:attachment":[{"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/media?parent=1065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/categories?post=1065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/symphonict.nesic.co.jp\/tech-blog\/wp-json\/wp\/v2\/tags?post=1065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}