Skip to content

Commit b4957e4

Browse files
[Integrations] Add integration of S3 Access log (#1684)
* Add integration of S3 Access log Signed-off-by: Ryan Liang <[email protected]> * Correct the checkpoint placeholder Signed-off-by: Ryan Liang <[email protected]> * Correct the parsing of timestamp Signed-off-by: Ryan Liang <[email protected]> * Correct the auto refresh config boolean Signed-off-by: Ryan Liang <[email protected]> --------- Signed-off-by: Ryan Liang <[email protected]> (cherry picked from commit ee0d748) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent f57c872 commit b4957e4

File tree

3 files changed

+97
-2
lines changed

3 files changed

+97
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
CREATE MATERIALIZED VIEW {table_name}_mview AS
2+
SELECT
3+
owner_id AS `aws.s3.bucket_owner`,
4+
bucket_name AS `aws.s3.bucket`,
5+
to_timestamp(CONCAT(SUBSTRING(request_time, 2), ' ', SUBSTRING(request_time_zone, 1, LENGTH(request_time_zone) - 1)), 'dd/MMM/yyyy:HH:mm:ss Z') AS `@timestamp`,
6+
CONCAT(request_time, ' ', request_time_zone) AS `aws.s3.request_time`,
7+
remote_ip AS `aws.s3.remote_ip`,
8+
requester AS `aws.s3.requester`,
9+
request_id AS `aws.s3.request_id`,
10+
operation AS `aws.s3.operation`,
11+
key AS `aws.s3.key`,
12+
request_uri AS `aws.s3.request_uri`,
13+
http_status AS `aws.s3.http_status`,
14+
error_code AS `aws.s3.error_code`,
15+
bytes_sent AS `aws.s3.bytes_sent`,
16+
object_size AS `aws.s3.object_size`,
17+
CAST(total_time AS INTEGER) AS `aws.s3.total_time`,
18+
CAST(turn_around_time AS INTEGER) AS `aws.s3.turn_around_time`,
19+
referrer AS `aws.s3.referrer`,
20+
user_agent AS `aws.s3.user_agent`,
21+
version_id AS `aws.s3.version_id`,
22+
host_id AS `aws.s3.host_id`,
23+
signature_version AS `aws.s3.signature_version`,
24+
cipher_suite AS `aws.s3.cipher_suite`,
25+
authentication_type AS `aws.s3.authentication_type`,
26+
host_header AS `aws.s3.host_header`,
27+
tls_version AS `aws.s3.tls_version`
28+
FROM
29+
{table_name}
30+
WITH (
31+
auto_refresh = true,
32+
checkpoint_location = '{s3_checkpoint_location}',
33+
watermark_delay = '1 Minute',
34+
extra_options = '{ "{table_name}": { "maxFilesPerTrigger": "10" }}'
35+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
CREATE EXTERNAL TABLE IF NOT EXISTS {table_name} (
2+
owner_id STRING,
3+
bucket_name STRING,
4+
request_time STRING,
5+
request_time_zone STRING,
6+
remote_ip STRING,
7+
requester STRING,
8+
request_id STRING,
9+
operation STRING,
10+
key STRING,
11+
request_uri STRING,
12+
http_status STRING,
13+
error_code STRING,
14+
bytes_sent BIGINT,
15+
object_size BIGINT,
16+
total_time STRING,
17+
turn_around_time STRING,
18+
referrer STRING,
19+
user_agent STRING,
20+
version_id STRING,
21+
host_id STRING,
22+
signature_version STRING,
23+
cipher_suite STRING,
24+
authentication_type STRING,
25+
host_header STRING,
26+
tls_version STRING
27+
)
28+
USING csv
29+
OPTIONS (
30+
sep=' '
31+
)
32+
LOCATION '{s3_bucket_location}';

server/adaptors/integrations/__data__/repository/aws_s3/aws_s3-1.0.0.json

+30-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,23 @@
55
"description": "Analyze Amazon S3 server logs.",
66
"license": "Apache-2.0",
77
"type": "logs_s3",
8-
"labels": ["Observability", "Logs", "AWS", "Cloud"],
8+
"labels": ["Observability", "Logs", "AWS", "Cloud", "Flint S3"],
99
"author": "OpenSearch",
1010
"sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_s3/info",
11+
"workflows": [
12+
{
13+
"name": "queries",
14+
"label": "Queries (recommended)",
15+
"description": "Tables and pre-written queries for quickly getting insights on your data.",
16+
"enabled_by_default": true
17+
},
18+
{
19+
"name": "dashboards",
20+
"label": "Dashboards & Visualizations",
21+
"description": "Dashboards and indices that enable you to easily visualize important metrics.",
22+
"enabled_by_default": false
23+
}
24+
],
1125
"statics": {
1226
"logo": {
1327
"annotation": "S3 Logo",
@@ -39,7 +53,21 @@
3953
"name": "aws_s3",
4054
"version": "1.0.0",
4155
"extension": "ndjson",
42-
"type": "savedObjectBundle"
56+
"type": "savedObjectBundle",
57+
"workflows": ["dashboards"]
58+
},
59+
{
60+
"name": "create_table",
61+
"version": "1.0.0",
62+
"extension": "sql",
63+
"type": "query"
64+
},
65+
{
66+
"name": "create_mv",
67+
"version": "1.0.0",
68+
"extension": "sql",
69+
"type": "query",
70+
"workflows": ["dashboards"]
4371
}
4472
],
4573
"sampleData": {

0 commit comments

Comments
 (0)