112 lines
3.4 KiB
Markdown
112 lines
3.4 KiB
Markdown
# Logging Destination: Snowflake
|
|
|
|
This addon configures AWS Kinesis Firehose to send Fleet's osquery logs to Snowflake. It creates:
|
|
|
|
1. Kinesis Firehose delivery streams for each log type (results, status, and audit)
|
|
2. A single S3 bucket for storing all failed delivery attempts
|
|
3. IAM roles and policies for the Firehose streams to access the S3 bucket
|
|
4. An IAM policy for Fleet to access the Firehose streams
|
|
|
|
## How to use
|
|
|
|
```hcl
|
|
module "snowflake-logging" {
|
|
source = "github.com/fleetdm/fleet-terraform//addons/logging-destination-snowflake?depth=1&ref=tf-mod-addon-logging-destination-snowflake-v1.0.2"
|
|
|
|
s3_bucket_config = {
|
|
name_prefix = "fleet-snowflake-failure"
|
|
expires_days = 5
|
|
}
|
|
snowflake_shared = {
|
|
account_url = "https://<snowflake_url>.snowflakecomputing.com"
|
|
private_key = "<pass this in securely>"
|
|
key_passphrase = "<pass this in securely>"
|
|
user = "fleet_user"
|
|
snowflake_role_configuration = {
|
|
enabled = true
|
|
snowflake_role = "fleet_cloud_rl"
|
|
}
|
|
}
|
|
|
|
log_destinations = {
|
|
results = {
|
|
name = "fleet-osquery-results-snowflake"
|
|
database = "fleet_cloud_db"
|
|
schema = "fleet_cloud_schema"
|
|
table = "osquery_results"
|
|
buffering_size = 2
|
|
buffering_interval = 60
|
|
s3_buffering_size = 10
|
|
s3_buffering_interval = 400
|
|
s3_buffering_interval = 400
|
|
s3_error_output_prefix = "results/"
|
|
data_loading_option = "VARIANT_CONTENT_MAPPING"
|
|
content_column_name = "results"
|
|
},
|
|
status = {
|
|
name = "fleet-osquery-status-snowflake"
|
|
database = "fleet_cloud_db"
|
|
schema = "fleet_cloud_schema"
|
|
table = "osquery_status"
|
|
user = "fleet"
|
|
buffering_size = 2
|
|
buffering_interval = 60
|
|
s3_buffering_size = 10
|
|
s3_buffering_interval = 400
|
|
s3_buffering_interval = 400
|
|
s3_error_output_prefix = "status/"
|
|
data_loading_option = "VARIANT_CONTENT_MAPPING"
|
|
content_column_name = "status"
|
|
},
|
|
audit = {
|
|
name = "fleet-audit-snowflake"
|
|
database = "fleet_cloud_db"
|
|
schema = "fleet_cloud_schema"
|
|
table = "fleet_audit"
|
|
buffering_size = 2
|
|
buffering_interval = 60
|
|
s3_buffering_size = 10
|
|
s3_buffering_interval = 400
|
|
s3_error_output_prefix = "audit/"
|
|
}
|
|
}
|
|
}
|
|
|
|
```
|
|
|
|
Then you can use the module's outputs in your Fleet configuration:
|
|
|
|
```hcl
|
|
module "fleet" {
|
|
source = "github.com/fleetdm/fleet-terraform?depth=1&ref=tf-mod-root-v1.16.4"
|
|
certificate_arn = module.acm.acm_certificate_arn
|
|
|
|
vpc = {
|
|
name = local.vpc_name
|
|
# azs = ["us-east-2a", "us-east-2b", "us-east-2c"]
|
|
}
|
|
|
|
fleet_config = {
|
|
image = "fleetdm/fleet:v4.70.1"
|
|
autoscaling = {
|
|
min_capacity = 2
|
|
max_capacity = 5
|
|
}
|
|
mem = 4096
|
|
cpu = 512
|
|
extra_environment_variables = merge(
|
|
local.fleet_environment_variables,
|
|
# Uncomment to enable Snowflake logging
|
|
module.snowflake-logging.fleet_extra_environment_variables
|
|
)
|
|
extra_iam_policies = concat(
|
|
# Uncomment to enable Snowflake logging
|
|
module.snowflake-logging.fleet_extra_iam_policies,
|
|
)
|
|
}
|
|
|
|
# ... other Fleet configuration ...
|
|
}
|
|
```
|
|
|