---
title: "Google Cloud StorageのWebsite Logging設定！ | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/google-cloud-storage-website-logging"
description: "以前やったGoogle Cloud Storageで静的Webサイトを公開する！でちょっとLogging設定やってみたので！ Access Logs & Storage Data Google Cloud Storage offers access logs and storage data in the form of CSV files that you can download and view… cloud.google.com…"
---

# Google Cloud StorageのWebsite Logging設定！

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2015年3月25日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#Google Cloud](/tags/google-cloud/)[#Cloud Storage](/tags/cloud-storage/)

![Google Cloud StorageのWebsite Logging設定！](/_astro/ogp.C1F3vWq__Z5YhTO.webp)

以前やった[Google Cloud Storageで静的Webサイトを公開する！](https://medium.com/@yusuke_h/google-cloud-storage%E3%81%A7%E9%9D%99%E7%9A%84web%E3%82%B5%E3%82%A4%E3%83%88%E3%82%92%E5%85%AC%E9%96%8B%E3%81%99%E3%82%8B-965feafb7ca6)でちょっとLogging設定やってみたので！

## Access Logs & Storage Data

### Google Cloud Storage offers access logs and storage data in the form of CSV files that you can download and view…

cloud.google.com

## まずはCloud StorageでWebsite設定！

Plain textcontent\_copy

```
gsutil mb -c STANDARD -l ASIA gs://xxx.xxxx.com
gsutil defacl set public-read gs://xxx.xxxx.com
gsutil web set -m index.html -e error.html gs://xxx.xxxx.com
```

## そしたらLogging設定！

せっかくなので先日と同じでNEARLINEで作りました。

Plain textcontent\_copy

```
gsutil mb -c NEARLINE -l ASIA gs://logs_xxx_xxxx_com
gsutil acl ch -g cloud-storage-analytics@google.com:W gs://logs_xxx_xxxx_com
gsutil defacl set project-private gs://logs_xxx_xxxx_com
gsutil logging set on -b gs://logs_xxx_xxxx_com -o xxx.xxxx.com-accesslog gs://xxx.xxxx.com
```

## 設定確認

Plain textcontent\_copy

```
gsutil logging get gs://xxx.xxxx.com
```

しばらく待つと出力されます。

こんなFormatみたい

1行目にcolumn名のheaderついてる

-   time\_micros
-   c\_ip
-   c\_ip\_type
-   c\_ip\_region
-   cs\_method
-   cs\_uri
-   sc\_status
-   cs\_bytes
-   sc\_bytes
-   time\_taken\_micros
-   cs\_host
-   cs\_referer
-   cs\_user\_agent
-   s\_request\_id
-   cs\_operation
-   cs\_bucket
-   cs\_object

## 感想！

簡単にできる！

でもBigQueryに入れてごにょごにょするのが楽しいかな・・・

## Access Logs & Storage Data

### Google Cloud Storage offers access logs and storage data in the form of CSV files that you can download and view…

cloud.google.com

転載：[Google Cloud StorageのWebsite Logging設定！](https://medium.com/@yusuke_h/google-cloud-storage%E3%81%AEwebsite-logging%E8%A8%AD%E5%AE%9A-c34e45377104)

この記事は [Medium（@yusuke\_h）](https://medium.com/@yusuke_h) からの転載です。

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [X](https://x.com/yusukeh "X")
-   [GitHub](https://github.com/yusukeh "GitHub")
-   [Medium](https://medium.com/@yusukeh "Medium")
-   [Facebook](https://www.facebook.com/yusuke.exzm "Facebook")
-   [Instagram](https://www.instagram.com/yusukehasegawa/ "Instagram")
-   [LinkedIn](https://www.linkedin.com/in/hasegawa-yusuke-091b4164/ "LinkedIn")

[プロフィールと記事一覧](/authors/yusukeh/)