--- title: "Use Object Storage bucket access log" slug: "dataquery-example-objectstorage-bucketlog-vpc" updated: 2026-09-17T09:17:55Z published: 2026-09-17T09:17:55Z canonical: "guide.ncloud-docs.com/dataquery-example-objectstorage-bucketlog-vpc" --- > ## Documentation Index > Fetch the complete documentation index at: https://guide.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # Use Object Storage bucket access log Available in VPC ## Use Object Storage bucket access log You can analyze access logs collected in Object Storage using Data Query. This example shows the process of analyzing Object Storage bucket access logs with various template queries and visualizing them with business intelligence (BI) tools. #### Feature summary - [Create table with scanner](/docs/en/dataquery-example-objectstorage-bucketlog-vpc#%EC%9B%90%EB%B3%B8%EB%8D%B0%EC%9D%B4%ED%84%B0%ED%85%8C%EC%9D%B4%EB%B8%94%EC%83%9D%EC%84%B1) - Using data as table by Data Catalog - [Run query and view results](/docs/en/dataquery-example-objectstorage-bucketlog-vpc#%ED%85%9C%ED%94%8C%EB%A6%BF%EC%BF%BC%EB%A6%AC%EC%9D%B4%EC%9A%A9-%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%B6%84%EC%84%9D) by Data Query - [Visualize through integration with BI](/docs/en/dataquery-example-objectstorage-bucketlog-vpc#BI%ED%99%9C%EC%9A%A9%EC%98%88%EC%8B%9C) by Data Query --- ### 1. Configure Object Storage bucket access log You can check the activation status and creation of Object Storage bucket access logs. #### Activate bucket access log - When you activate the bucket access log in Object Storage, you can save the access history of the bucket in log files. - You can use this log data as an analysis target in Data Query. - Example of access log settings | Item | Set value | | --- | --- | | Bucket name | Bucket to analyze access log | | Bucket to save to | Bucket where the access logs are to be saved | | Log file prefix | bucket_access_log_ | - For more information on access log settings, see [Object Storage user guide](/docs/en/objectstorage-use-bucket#%EB%A1%9C%EA%B7%B8-%EA%B4%80%EB%A6%AC). #### Create access log Access the bucket through the client so that the access log data is actually created. Caution - When selecting the bucket where the access logs are to be saved, it is recommended to use a new bucket with no other data included. If there are other files in the bucket, queries to create and view tables may not operate as expected. - Access log files are not created in real time. For more information on the creation time and cycle of the access log, see [Object Storage user guide](/docs/en/objectstorage-use-bucket#%EB%A1%9C%EA%B7%B8-%EA%B4%80%EB%A6%AC). ### 2. Create data table to be analyzed #### Create data table (use data as table) - Use the scanner feature of Data Catalog to create a source data table that refers to data saved in Object Storage. - Refer to the following setting example to enter the values, and click the Start button to add a table: - Scanner settings example | Item | Set value | | --- | --- | | Data type | Object Storage | | Path | s3a://[Bucket specified from access log configuration]/ | | Scan range | Partial, 10 items | | Execution cycle | On-demand | | Pattern | Use: Include, bucket_access_log_* | | Partition setting | All partitioning form | | Collection option | Update table definition | | Table merging | True | | Table number limit | 1 | - For more information about scanner, see the [Data Catalog user guide](/docs/en/datacatalog-scanner-vpc#%EC%8A%A4%EC%BA%90%EB%84%88-%EC%83%9D%EC%84%B1). #### Check creation of data table It may take several seconds to minutes to create a table with a scanner. In the table list on the left, you can search to verify whether a table with **the storage bucket name specified in the access log settings** has been created. ### 3. Use template query to analyze access log data Use provided template queries to analyze the access log data. You can run queries through the console editor, BI, or CLI, or integrate with the user application business logics using JDBC or SDK. - [CLI user guide](/docs/en/dataquery-cli-vpc) : How to connect and use CLI. - [JDBC user guide](/docs/en/dataquery-jdbc-vpc) : Supports DB tool and BI connection. - [SDK user guide](/docs/en/dataquery-python-client-vpc) : Integrates with user application. - [External BI connection guide](/docs/en/dataquery-bi-preparing-vpc) : Integrates with BIs, such as Superset and Zeppelin. #### Create VIEW table To use template queries, run the following query to create a VIEW table: Instead of creating a VIEW table, you can use the scanned data table name in the template query to see the same result. ``` CREATE OR REPLACE VIEW "data_catalog"."default"."bucket_access_log" AS SELECT * FROM "data_catalog"."default"."scanned_table"; -- replace database/table name with yours ``` #### Provided template query - View data for certain period (Range query) ``` SELECT date_trunc('second', from_unixtime(CAST(timestamp_start AS BIGINT) / 1000.0) AT TIME ZONE 'Asia/Seoul') AS log_time, remote_user, request_method, request_type, status, object_name, response_length FROM data_catalog.default.bucket_access_log WHERE from_unixtime(CAST(timestamp_start AS BIGINT) / 1000.0) AT TIME ZONE 'Asia/Seoul' BETWEEN TIMESTAMP '2025-01-01 00:00:00 Asia/Seoul' AND TIMESTAMP '2025-12-31 23:59:59 Asia/Seoul' ORDER BY log_time; ``` - Top 10 most accessed objects ``` SELECT object_name, COUNT(*) AS access_count FROM data_catalog.default.bucket_access_log WHERE object_name IS NOT NULL GROUP BY object_name ORDER BY access_count DESC LIMIT 10; ``` - Top 10 most accessed remote_user (including access_key type) ``` SELECT remote_user, COUNT(*) AS request_count FROM data_catalog.default.bucket_access_log GROUP BY remote_user ORDER BY request_count DESC LIMIT 10; ``` - Request distribution by HTTP status code ``` SELECT status, COUNT(*) AS request_count FROM data_catalog.default.bucket_access_log GROUP BY status ORDER BY request_count DESC; ``` - Number of request by method per 10 minutes ``` SELECT from_unixtime(floor(CAST(timestamp_start AS DOUBLE) / 1000.0 / 600.0) * 600.0) AT TIME ZONE 'Asia/Seoul' AS time_slot, request_method, COUNT(*) AS request_count FROM data_catalog.default.bucket_access_log GROUP BY 1, request_method ORDER BY 1; ``` - Maximum traffic by time period (peak time) ``` SELECT date_trunc('hour', from_unixtime(CAST(timestamp_start AS BIGINT) / 1000.0) AT TIME ZONE 'Asia/Seoul') AS hour_slot, COUNT(*) AS access_count FROM data_catalog.default.bucket_access_log GROUP BY date_trunc('hour', from_unixtime(CAST(timestamp_start AS BIGINT) / 1000.0) AT TIME ZONE 'Asia/Seoul') ORDER BY access_count DESC LIMIT 5; ``` #### BI use examples You can visualize the data tables you created and template queries with BI tools, such as Superset. For more information on how to integrate with external BIs, see the [Data Query BI integration guide](/docs/en/dataquery-bi-preparing-vpc). - Example: Access volume trend chart, traffic analysis by time period, top requested objects dashboard, etc. ![dataquery-example-obs-accesslog-bi.png](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/dataquery-example-obs-accesslog-bi.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A40%3A39Z&se=2026-11-14T05%3A40%3A39Z&sr=c&sp=r&sig=9R2O%2F1TlcvUcCjstjPBac6wn%2B5VEyjJ7ocpAnMmKFz0%3D)