Skip to content

Commit

Permalink
added cloudtrail, waf, vpc_flow integrations
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed Jun 12, 2024
1 parent 5a813f5 commit 8672013
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Monitor IP traffic with VPC Flow Logs.",
"license": "Apache-2.0",
"type": "logs_vpc",
"labels": ["Observability", "Logs", "AWS", "Cloud", "Flint S3"],
"labels": ["Security Lake", "Observability", "Logs", "AWS", "Cloud", "Flint S3"],
"author": "Haidong Wang",
"sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_vpc_flow/info",
"workflows": [
Expand Down Expand Up @@ -38,6 +38,18 @@
"label": "Refreshing and populate the pre-aggregated projections ",
"description": "This step populate the pre-aggregated projections by enabling the REFRESH command to run, this step depends on selection of the previous `flint-pre-agg-dashboards` step",
"enabled_by_default": false
},
{
"name": "queries-security-lake",
"label": "Queries (recommended)",
"description": "Tables and pre-written queries for quickly getting insights on your data.",
"enabled_by_default": true
},
{
"name": "dashboards-security-lake",
"label": "Dashboards & Visualizations",
"description": "Dashboards and indices that enable you to easily visualize important metrics.",
"enabled_by_default": true
}
],
"statics": {
Expand Down Expand Up @@ -179,6 +191,20 @@
"extension": "sql",
"type": "query",
"workflows": ["flint-pre-agg-refresh"]
},
{
"name": "aws_vpc_mv_schema_security_lake_2_0",
"version": "1.0.0",
"extension": "sql",
"type": "query",
"workflows": ["dashboards-security-lake"]
},
{
"name": "aws_vpc_flow_security_lake_2_0",
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["dashboards-security-lake"]
}
],
"sampleData": {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
CREATE MATERIALIZED VIEW {table_name}__live_mview_2 AS
SELECT
CAST(IFNULL(`src_endpoint.port`, 0) AS LONG) AS `aws.vpc.srcport`,
CAST(IFNULL(`src_endpoint.ip`, 'Unknown') AS STRING) AS `aws.vpc.pkt-src-aws-service`,
CAST(IFNULL(`src_endpoint.ip`, '0.0.0.0') AS STRING) AS `aws.vpc.srcaddr`,
CAST(IFNULL(`src_endpoint.interface_uid`, 'Unknown') AS STRING) AS `aws.vpc.src-interface_uid`,
CAST(IFNULL(src_endpoint.vpc_uid, 'Unknown') AS STRING) AS `aws.vpc.src-vpc_uid`,
CAST(IFNULL(src_endpoint.instance_uid, 'Unknown') AS STRING) AS `aws.vpc.src-instance_uid`,
CAST(IFNULL(src_endpoint.subnet_uid, 'Unknown') AS STRING) AS `aws.vpc.src-subnet_uid`,
CAST(IFNULL(dst_endpoint.port, 0) AS LONG) AS `aws.vpc.dstport`,
CAST(IFNULL(dst_endpoint.ip, 'Unknown') AS STRING) AS `aws.vpc.pkt-dst-aws-service`,
CAST(IFNULL(dst_endpoint.ip, '0.0.0.0') AS STRING) AS `aws.vpc.dstaddr`,
CAST(IFNULL(connection_info.direction, 'Unknown') AS STRING) AS `aws.vpc.flow-direction`,
CAST(IFNULL(connection_info.tcp_flags, '0') AS STRING) AS `aws.vpc.connection.tcp_flags`,
CAST(IFNULL(traffic.packets, 0) AS LONG) AS `aws.vpc.packets`,
CAST(IFNULL(traffic.bytes, 0) AS LONG) AS `aws.vpc.bytes`,
CAST(start_time_dt AS TIMESTAMP) AS `@timestamp`,
CAST(start_time_dt AS TIMESTAMP) AS `start_time`,
CAST(start_time_dt AS TIMESTAMP) AS `interval_start_time`,
CAST(end_time_dt AS TIMESTAMP) AS `end_time`,
CAST(IFNULL(status_code, 'Unknown') AS STRING) AS `aws.vpc.status_code`,
CAST(IFNULL(metadata.product.version, 0) AS LONG) AS `aws.vpc.version`,
CAST(IFNULL(connection_info.protocol_ver, 'Unknown') AS STRING) AS `aws.vpc.type_name`,
CAST(IFNULL(connection_info.boundary_id, 0) AS LONG) AS `aws.vpc.traffic_path`,
CAST(IFNULL(cloud.zone, 'Unknown') AS STRING) AS `aws.vpc.az_id`,
CAST(IFNULL(activity_name, 'Unknown') AS STRING) AS `aws.vpc.action`,
CAST(IFNULL(cloud.region, 'Unknown') AS STRING) AS `aws.vpc.region`,
CAST(IFNULL(cloud.account.uid, 'Unknown') AS STRING) AS `aws.vpc.account-id`,
CAST(IFNULL(unmapped['sublocation_type'], 'Unknown') AS STRING) AS `aws.vpc.sublocation_type`,
CAST(IFNULL(unmapped['sublocation_id'], 'Unknown') AS STRING) AS `aws.vpc.sublocation_id`

FROM
{table_name}
WITH (
auto_refresh = true,
refresh_interval = '15 Minute',
checkpoint_location = '{s3_checkpoint_location}',
watermark_delay = '1 Minute',
extra_options = '{ "{table_name}": { "maxFilesPerTrigger": "10" }}'
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
CREATE MATERIALIZED VIEW {table_name}__mview AS
SELECT
CAST(IFNULL(`actor.user.type`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.type`,
CAST(IFNULL(`actor.user.uid_alt`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.principalId`,
CAST(IFNULL(`actor.user.uid`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.arn`,
CAST(IFNULL(`actor.user.account.uid`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.accountId`,
CAST(IFNULL(`actor.invoked_by`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.invokedBy`,
CAST(IFNULL(`actor.user.credential_uid`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.accessKeyId`,
CAST(IFNULL(`actor.user.name`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.userName`,
CAST(IFNULL(`actor.session.is_mfa`, False) AS BOOLEAN) AS `aws.cloudtrail.userIdentity.sessionContext.attributes.mfaAuthenticated`,
CAST( actor.session.created_time_dt AS TIMESTAMP) AS `aws.cloudtrail.userIdentity.sessionContext.attributes.creationDate`,
CAST(IFNULL(unmapped['userIdentity.sessionContext.sessionIssuer.type'], 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.sessionContext.sessionIssuer.type`,
CAST(IFNULL(unmapped['userIdentity.sessionContext.sessionIssuer.principalId'], 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.sessionContext.sessionIssuer.principalId`,
CAST(IFNULL(`actor.session.issuer`, 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.sessionContext.sessionIssuer.arn`,
CAST(IFNULL(unmapped['userIdentity.sessionContext.sessionIssuer.accountId'], 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.sessionContext.sessionIssuer.accountId`,
CAST(IFNULL(unmapped['userIdentity.sessionContext.sessionIssuer.userName'], 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.sessionContext.sessionIssuer.userName`,
CAST(IFNULL(unmapped['userIdentity.sessionContext.ec2RoleDelivery'], 'Unknown') AS STRING) AS `aws.cloudtrail.userIdentity.sessionContext.ec2RoleDelivery`,

CAST(IFNULL(`metadata.product.version`, 'Unknown') AS STRING) AS `aws.cloudtrail.eventVersion`,
CAST( time AS TIMESTAMP) AS `@timestamp`,
CAST(IFNULL(`api.service.name`, 'Unknown') AS STRING) AS `aws.cloudtrail.eventSource`,
CAST(IFNULL(`api.operation`, 'Unknown') AS STRING) AS `aws.cloudtrail.eventName`,
CAST(IFNULL(`metadata.product.feature.name`, 'Unknown') AS STRING) AS `aws.cloudtrail.eventCategory`,
CAST(IFNULL(`metadata.event_code`, 'Unknown') AS STRING) AS `aws.cloudtrail.eventType`,
CAST(IFNULL(`metadata.uid`, 'Unknown') AS STRING) AS `aws.cloudtrail.eventId`,

CAST(IFNULL(`cloud.region`, 'Unknown') AS STRING) AS `aws.cloudtrail.awsRegion`,
CAST(IFNULL(`src_endpoint.ip`, '0.0.0.0') AS STRING) AS `aws.cloudtrail.sourceIPAddress`,
CAST(IFNULL(`http_request.user_agent`, 'Unknown') AS STRING) AS `aws.cloudtrail.userAgent`,
CAST(IFNULL(`api.response.error`, 'Unknown') AS STRING) AS `errorCode`,
CAST(IFNULL(`api.response.message`, 'Unknown') AS STRING) AS `errorMessage`,
CAST(IFNULL(`api.request.data`, 'Unknown') AS STRING) AS `aws.cloudtrail.requestParameter`,
CAST(IFNULL(`api.response.data`, 'Unknown') AS STRING) AS `aws.cloudtrail.responseElements`,
CAST(IFNULL(`dst_endpoint.svc_name`, 'Unknown') AS STRING) AS `aws.cloudtrail.additionalEventData`,
CAST(IFNULL(`api.request.uid`, 'Unknown') AS STRING) AS `aws.cloudtrail.requestId`,
resources AS `aws.cloudtrail.resources`,
CAST(IFNULL(`api.version`, 'Unknown') AS STRING) AS `aws.cloudtrail.apiVersion`,
CAST(IFNULL(unmapped['readOnly'], False) AS BOOLEAN) AS `aws.cloudtrail.readOnly`,
CAST(IFNULL(unmapped['recipientAccountId'], 0) AS LONG) AS `aws.cloudtrail.recipientAccountId`,
CAST(IFNULL(unmapped['sharedEventId'], 'Unknown') AS STRING) AS `aws.cloudtrail.sharedEventId`,
CAST(IFNULL(`src_endpoint.uid`, 'Unknown') AS STRING) AS `aws.cloudtrail.vpcEndpointId`,
CAST(IFNULL(unmapped['tlsDetails.tlsVersion'], 'Unknown') AS STRING) AS `aws.cloudtrail.tlsDetails.tls_version`,
CAST(IFNULL(unmapped['tlsDetails.cipherSuite'], 'Unknown') AS STRING) AS `aws.cloudtrail.tlsDetailscipher_suite`,
CAST(IFNULL(unmapped['tlsDetails.clientProvidedHostHeader'], 'Unknown') AS STRING) AS `aws.cloudtrail.tlsDetailsclient_provided_host_header`
FROM
{table_name}
WITH (
auto_refresh = true,
refresh_interval = '15 Minute',
checkpoint_location = '{s3_checkpoint_location}',
watermark_delay = '1 Minute',
extra_options = '{ "{table_name}": { "maxFilesPerTrigger": "10" }}'
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Analyze CloudTrail events.",
"license": "Apache-2.0",
"type": "logs-aws_cloudtrail",
"labels": ["Observability", "Logs", "AWS", "Cloud", "Flint S3"],
"labels": ["Security Lake", "Observability", "Logs", "AWS", "Cloud", "Flint S3"],
"author": "OpenSearch",
"sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_cloudtrail/info",
"workflows": [
Expand All @@ -15,6 +15,12 @@
"description": "Tables and pre-written queries for quickly getting insights on your data.",
"enabled_by_default": true
},
{
"name": "queries-security-lake",
"label": "Queries (recommended)",
"description": "Tables and pre-written queries for quickly getting insights on your data.",
"enabled_by_default": true
},
{
"name": "dashboards",
"label": "Dashboards & Visualizations",
Expand All @@ -26,6 +32,12 @@
"label": "Dashboards & Visualizations adapted to Flint",
"description": "Dashboards and visualizations adapted to Flint S3 datasource that enable you to easily visualize data residing on S3",
"enabled_by_default": false
},
{
"name": "dashboards-security-lake",
"label": "Dashboards & Visualizations",
"description": "Dashboards and indices that enable you to easily visualize important security related metrics.",
"enabled_by_default": true
}
],
"statics": {
Expand Down Expand Up @@ -71,7 +83,7 @@
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["dashboards-flint"]
"workflows": ["dashboards-flint", "dashboards-security-lake"]
},
{
"name": "create_skipping_index",
Expand All @@ -85,7 +97,7 @@
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["queries"]
"workflows": ["queries", "queries-security-lake"]
},
{
"name": "create_table_cloud-trail",
Expand All @@ -100,6 +112,13 @@
"extension": "sql",
"type": "query",
"workflows": ["dashboards-flint"]
},
{
"name": "create_mv_cloud-trail_security_lake_2_0",
"version": "1.0.0",
"extension": "sql",
"type": "query",
"workflows": ["dashboards-security-lake"]
}
],
"sampleData": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE MATERIALIZED VIEW {table_name}__mview AS
SELECT
CAST(FROM_UNIXTIME(`time`/ 1000) AS TIMESTAMP) AS `@timestamp`,
CAST(IFNULL(`metadata.product.version`, 'Unknown') AS STRING) AS `aws.waf.formatVersion`,
CAST(IFNULL(`metadata.product.feature.uid`, 'Unknown') AS STRING) AS `aws.waf.webaclId`,
CAST(IFNULL(`firewall_rule.uid`, 'Unknown') AS STRING) AS `aws.waf.terminatingRuleId`,
CAST(IFNULL(`firewall_rule.type`, 'Unknown') AS STRING) AS `aws.waf.terminatingRuleType`,
CAST(IFNULL(action, 'Unknown') AS STRING) AS `aws.waf.action`,
CAST(IFNULL(`src_endpoint.svc_name`, 'Unknown') AS STRING) AS `aws.waf.httpSourceName`,
CAST(IFNULL(`src_endpoint.uid`, 'Unknown') AS STRING) AS `aws.waf.httpSourceId`,
ruleGroupList AS `aws.waf.ruleGroupList`,
unmapped['rateBasedRuleList'] AS `aws.waf.rateBasedRuleList`,
nonTerminatingMatchingRules AS `aws.waf.nonTerminatingMatchingRules`,
CAST(IFNULL(`http_status`, 0) AS LONG) AS `aws.waf.responseCodeSent`,
httpRequest AS `aws.waf.httpRequest`,
metadata.labels AS `aws.waf.labels`,
unmapped['captchaResponse'] AS `aws.waf.captchaResponse`
FROM
{table_name}
WITH (
auto_refresh = true,
refresh_interval = '15 Minute',
checkpoint_location = '{s3_checkpoint_location}',
watermark_delay = '1 Minute',
extra_options = '{ "{table_name}": { "maxFilesPerTrigger": "10" }}'
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@
"description": "Tables and pre-written queries for quickly getting insights on your data.",
"enabled_by_default": true
},
{
"name": "queries-security-lake",
"label": "Queries (recommended)",
"description": "Tables and pre-written queries for quickly getting insights on your data.",
"enabled_by_default": true
},
{
"name": "dashboards",
"label": "Dashboards & Visualizations",
"description": "Dashboards and indices that enable you to easily visualize important metrics.",
"enabled_by_default": false
},
{
"name": "dashboards-security-lake",
"label": "Dashboards & Visualizations",
"description": "Dashboards and indices that enable you to easily visualize important metrics.",
"enabled_by_default": true
}
],
"statics": {
Expand Down Expand Up @@ -58,7 +70,7 @@
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["dashboards"]
"workflows": ["dashboards", "dashboards-security-lake"]
},
{
"name": "create_table",
Expand All @@ -74,6 +86,13 @@
"workflows": ["dashboards"]

},
{
"name": "create_mv_security_lake_2_0",
"version": "1.0.0",
"extension": "sql",
"type": "query",
"workflows": ["dashboards-security-lake"]
},
{
"name": "create_skipping_index",
"version": "1.0.0",
Expand All @@ -86,7 +105,7 @@
"version": "1.0.0",
"extension": "ndjson",
"type": "savedObjectBundle",
"workflows": ["queries"]
"workflows": ["queries", "queries-security-lake"]
}
],
"sampleData": {
Expand Down

0 comments on commit 8672013

Please sign in to comment.