Skip to content

Commit

Permalink
Add option to use custom metadata with shipper (coralogix#145)
Browse files Browse the repository at this point in the history
* add option to use custom metadata

* fix changlog

* add option to use custom metadata

* sync the branch with master and add support for custom_csv_header
  • Loading branch information
guyrenny authored Apr 18, 2024
1 parent 40b3d39 commit 51d603b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v1.0.95
### 🚀 New components 🚀
#### **coralogix-aws-shipper**
- Add new variables custom_csv_header and custom_metadata

## v1.0.94
#### **coralogix-aws-shipper**
### 🧰 Bug fixes 🧰
Expand Down Expand Up @@ -31,7 +36,7 @@

## v1.0.90
### 💡 Enhancements 💡
#### **coralogix-aws-shipper**

- [cds-1050] add support for x86 to template

## v1.0.89
Expand Down
16 changes: 14 additions & 2 deletions examples/coralogix-aws-shipper/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ variable "cs_delimiter" {
default = ","
}

variable "custom_csv_header" {
type = string
description = "List separated by cs delimiter of a new headers for your csv, the variable must be with the same delimiter as the cs_delimiter, for example if the cs_delimiter is \";\" then the value of the variable should be name;country;age so the new headers will be name, country, age"
default = null
}

# cloudwatch variables

variable "log_groups" {
Expand Down Expand Up @@ -119,7 +125,7 @@ variable "cpu_arch" {
validation {
condition = contains(["arm64", "x86_64"], var.cpu_arch)
error_message = "The CPU architecture must be one of these values: [arm64, x86_64]."
}
}
}

# Integration Generic Config (Optional)
Expand Down Expand Up @@ -168,7 +174,7 @@ variable "integration_type" {
description = "the aws service that send the data to the s3"
type = string
validation {
condition = contains(["CloudWatch", "CloudTrail", "VpcFlow", "S3", "S3Csv", "Sns", "Sqs", "Kinesis", "CloudFront", "MSK", "Kafka","EcrScan", ""], var.integration_type)
condition = contains(["CloudWatch", "CloudTrail", "VpcFlow", "S3", "S3Csv", "Sns", "Sqs", "Kinesis", "CloudFront", "MSK", "Kafka", "EcrScan", ""], var.integration_type)
error_message = "The integration type must be: [CloudWatch, CloudTrail, VpcFlow, S3, S3Csv, Sns, Sqs, Kinesis, CloudFront, MSK, Kafka, EcrScan]."
}
default = ""
Expand Down Expand Up @@ -204,6 +210,12 @@ variable "add_metadata" {
type = string
}

variable "custom_metadata" {
default = null
description = "Add custom metadata to the log message. Expects comma separated values. Options are key1=value1,key2=value2 "
type = string
}

variable "integration_info" {
description = "Values of s3 integraion in case that you want to deploy more than one integration"
type = map(object({
Expand Down
2 changes: 2 additions & 0 deletions modules/coralogix-aws-shipper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ If you want to avoid this issue, you can deploy in other ways:
| <a name="input_s3_key_prefix"></a> [s3\_key\_prefix](#input\_s3\_key\_prefix) | The S3 path prefix to watch. | `string` | n/a | no |
| <a name="input_s3_key_suffix"></a> [s3\_key\_suffix](#input\_s3\_key\_suffix) | The S3 path suffix to watch. | `string` | n/a | no |
| <a name="input_csv_delimiter"></a> [csv_delimiter](#input\_csv\_delimiter) | Specify a single character to be used as a delimiter when ingesting a CSV file with a header line. This value is applicable when the S3Csv integration type is selected, for example, “,” or ” “. | `string` | n/a | no |
| <a name="input_custom_csv_header"></a> [custom\_csv\_header](#input\_custom\_csv\_header) | List seperated by cs delimiter of a new headers for your csv, the variable must be with the same delimiter as the cs_delimiter, for example if the cs_delimiter is \";\" then the value of the variable should be name;country;age and the new headers that you will see in corlaogix will be name, country, age | `string` | n/a | no |
| <a name="input_newline_pattern"></a> [newline\_pattern](#input\_newline\_pattern) | nter a regular expression to detect a new log line for multiline logs, e.g., \n(?=\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}). | `string` | n/a | no |
| [integration_info](#additional-parameters-for-integration_info) | A map of integration information. Use this when you want to deploy more then one integration using the same s3 bucket. [Parameters are here.](#integration_info)| `mapping` | n/a | no |

Expand Down Expand Up @@ -117,6 +118,7 @@ If you want to avoid this issue, you can deploy in other ways:

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_custom_metadata"></a> [custom\_metadata](#input\_custom\_metadata) | Add custom metadata to the log message. Expects comma separated values. Options are `key1=value1,key2=value2` | `string` | n/a | no |
| <a name="input_add_metadata"></a> [add\_metadata](#input\_add\_metadata) | Add metadata to the log message. Expects comma separated values. Options for S3 are `bucket_name`,`key_name`. For CloudWatch `stream_name` | `string` | n/a | no |
| <a name="input_lambda_name"></a> [lambda\_name](#input\_lambda\_name) | Name the Lambda function that you want to create. | `string` | n/a | no |
| <a name="input_blocking_pattern"></a> [blocking\_pattern](#input\_blocking\_pattern) | Enter a regular expression to identify lines excluded from being sent to Coralogix. For example, use `MainActivity.java:\d{3}` to match log lines with MainActivity followed by exactly three digits. | `string` | n/a | no |
Expand Down
2 changes: 2 additions & 0 deletions modules/coralogix-aws-shipper/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ module "lambda" {
BLOCKING_PATTERN = var.blocking_pattern
SAMPLING = tostring(var.sampling_rate)
ADD_METADATA = var.add_metadata
CUSTOM_METADATA = var.custom_metadata
CUSTOM_CSV_HEADER = var.custom_csv_header
}
s3_existing_package = {
bucket = var.custom_s3_bucket == "" ? "coralogix-serverless-repo-${data.aws_region.this.name}" : var.custom_s3_bucket
Expand Down
12 changes: 12 additions & 0 deletions modules/coralogix-aws-shipper/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ variable "cs_delimiter" {
default = ","
}

variable "custom_csv_header" {
type = string
description = "List separated by cs delimiter of a new headers for your csv, the variable must be with the same delimiter as the cs_delimiter, for example if the cs_delimiter is \";\" then the value of the variable should be name;country;age so the new headers will be name, country, age"
default = null
}

# cloudwatch variables

variable "log_groups" {
Expand Down Expand Up @@ -204,6 +210,12 @@ variable "add_metadata" {
type = string
}

variable "custom_metadata" {
default = null
description = "Add custom metadata to the log message. Expects comma separated values. Options are key1=value1,key2=value2 "
type = string
}

variable "integration_info" {
description = "Values of s3 integraion in case that you want to deploy more than one integration"
type = map(object({
Expand Down

0 comments on commit 51d603b

Please sign in to comment.