diff --git a/integrations/observability/nginx/assets/tables/create_mv_nginx-1.0.0.sql b/integrations/observability/nginx/assets/tables/create_mv_nginx-1.0.0.sql new file mode 100644 index 0000000..41181d0 --- /dev/null +++ b/integrations/observability/nginx/assets/tables/create_mv_nginx-1.0.0.sql @@ -0,0 +1,10 @@ +CREATE MATERIALIZED VIEW {table_name}_mview AS +SELECT + to_timestamp(trim(BOTH '[]' FROM concat(time_local_1, ' ', time_local_2)), 'dd/MMM/yyyy:HH:mm:ss Z') AS `@timestamp`, + split_part (request, ' ', 1) as `http.request.method`, + split_part (request, ' ', 2) as `http.url`, + split_part (request, ' ', 3) as `http.flavor`, + status AS `http.response.status_code`, + body_bytes_sent AS `http.response.bytes`, + 'nginx.access' AS `event.domain` +FROM {table_name} \ No newline at end of file diff --git a/integrations/observability/nginx/assets/tables/create_table_ngine-1.0.0.sql b/integrations/observability/nginx/assets/tables/create_table_ngine-1.0.0.sql new file mode 100644 index 0000000..c7f5d03 --- /dev/null +++ b/integrations/observability/nginx/assets/tables/create_table_ngine-1.0.0.sql @@ -0,0 +1,18 @@ +CREATE EXTERNAL TABLE {table_name} ( + remote_addr STRING, + empty_col STRING, + remote_user STRING, + time_local_1 STRING, + time_local_2 STRING, + request STRING, + status INT, + body_bytes_sent INT, + http_referer STRING, + http_user_agent STRING, + gzip_ratio STRING +) USING csv +LOCATION '{s3_bucket_location}' +OPTIONS ( + sep=' ', + nullValue='-' +) \ No newline at end of file diff --git a/integrations/observability/nginx/assets/tables/refresh_mv_nginx-1.0.0.sql b/integrations/observability/nginx/assets/tables/refresh_mv_nginx-1.0.0.sql new file mode 100644 index 0000000..9e68c57 --- /dev/null +++ b/integrations/observability/nginx/assets/tables/refresh_mv_nginx-1.0.0.sql @@ -0,0 +1 @@ +REFRESH MATERIALIZED VIEW {table_name}_mview; \ No newline at end of file diff --git a/integrations/observability/nginx/nginx-1.0.0.json b/integrations/observability/nginx/nginx-1.0.0.json index 8932231..48e4a60 100644 --- a/integrations/observability/nginx/nginx-1.0.0.json +++ b/integrations/observability/nginx/nginx-1.0.0.json @@ -6,7 +6,7 @@ "license": "Apache-2.0", "type-alias": "logs-nginx", "type": "logs", - "labels": ["log", "http", "communication"], + "labels": ["log", "http", "communication","Flint S3"], "author": "OpenSearch", "sourceUrl": "https://github.com/opensearch-project/opensearch-catalog/integrations/observability/nginx/info", "statics": { @@ -36,6 +36,23 @@ } ], "assets": { + "tables": [ + { + "name": "create_table_nginx", + "version": "1.0.0", + "language": "sql" + }, + { + "name": "create_mv_nginx", + "version": "1.0.0", + "language": "sql" + }, + { + "name": "refresh_mv_nginx", + "version": "1.0.0", + "language": "sql" + } + ], "savedObjects": { "name": "nginx", "version": "1.0.0"