Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the lambda to run with provided.al2 runtime V1.0.13[CDS-1437] #114

Merged
merged 8 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Changelog

## v1.0.13 / 2024-11-08
### 🧰 Bug fixes 🧰
- Allow the lambda to use the runtime `provided.al2`, by changing the binary build of cargo to a version that will support it in the Makefile. Add a parameter `FunctionRunTime` to allow users to choose the function runtime

## v1.0.12 / 2024-08-02
### 💡 Enhancements 💡
- Added support for CloudWatch over Kinesis Stream

## v1.0.11 / 2024-07-30
### 🧰 Bug fixes 🧰
- fix bug when trying to deploy CloudWatch integration. deploy with log group, with a name longer than 70 letters hit a limit with aws permission length, update the function so in case that the name is longer than 70 letters it will take the first 65 letters and the last 5.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coralogix-aws-shipper"
version = "1.0.12"
version = "1.0.13"
edition = "2021"

[dependencies]
Expand Down
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FUNCTIONS := handler
LAMBDA_NAME := coralogix-aws-shipper
ARCH := $(or ${RUST_ARCH},arm64)
ARCH_SPLIT = $(subst -, ,$(ARCH))

build-%:
cargo lambda build --release --${ARCH}
# Determine the target based on the architecture
ifeq ($(ARCH),arm64)
TARGET_ARCH := aarch64-unknown-linux-gnu.2.17
else ifeq ($(ARCH),x86-64)
TARGET_ARCH := x86_64-unknown-linux-gnu.2.17
else
$(error Unsupported architecture: $(ARCH))
endif

build-LambdaFunction:
cargo lambda build --release --target $(TARGET_ARCH)
@mkdir -p $(ARTIFACTS_DIR)
@cp -v ./target/lambda/${LAMBDA_NAME}/bootstrap $(ARTIFACTS_DIR)
set +xv
cp ./target/lambda/$(LAMBDA_NAME)/bootstrap $(ARTIFACTS_DIR)

delete:
sam delete
sam delete
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ These are the default presets for Lambda. Read [Troubleshooting](#troubleshootin
| FunctionTimeout | Set a timeout for the Lambda function in seconds. | 300 | :heavy_check_mark: |
| LogLevel | Specify the log level for the Lambda function, choosing from the following options: INFO, WARN, ERROR, DEBUG. | WARN | :heavy_check_mark: |
| LambdaLogRetention | Set the CloudWatch log retention period (in days) for logs generated by the Lambda function. | 5 | :heavy_check_mark: |
| FunctionRunTime | Type of runtime for the lambda, allowd values are provided.al2023 or provided.al2. | provided.al2023 | :heavy_check_mark: |
| FunctionArchitectures | Architectures for the lambda function, allowed values are arm64 or x86_64. | arm64 | :heavy_check_mark: |

### VPC Configuration (Optional)

Expand Down
2 changes: 1 addition & 1 deletion src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub async fn kinesis_logs(
coralogix_exporter: DynLogExporter,
config: &Config,
) -> Result<(), Error> {
let mut metadata_instance = Metadata {
let metadata_instance = Metadata {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
Expand Down
32 changes: 29 additions & 3 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Metadata:
- kinesis
- cloudfront
HomePageUrl: https://coralogix.com
SemanticVersion: 1.0.12
SemanticVersion: 1.0.13
SourceCodeUrl: https://github.com/coralogix/coralogix-aws-shipper

AWS::CloudFormation::Interface:
Expand Down Expand Up @@ -91,6 +91,8 @@ Metadata:
- FunctionTimeout
- LogLevel
- LambdaLogRetention
- FunctionRunTime
- FunctionArchitectures
- Label:
default: VPC configuration Optional
Parameters:
Expand Down Expand Up @@ -147,11 +149,13 @@ Parameters:
Description: |
Add metadata to the log message. Expects comma separated values. Options are bucket_name,key_name,stream_name
Default: ''

CustomMetadata:
Type: String
Description: |
Add custom metadata to the log message. Expects comma separated values. Options are key1=value1,key2=value2
Default: ''

BlockingPattern:
Type: String
Description: Regular expression to detect lines that should be excluded from sent to Coralogix
Expand Down Expand Up @@ -219,30 +223,51 @@ Parameters:
MaxValue: 900
Default: 300

FunctionRunTime:
Type: String
Description: Type of runtime for the lambda, allowd values are provided.al2023 or provided.al2
Default: provided.al2023
AllowedValues:
- provided.al2023
- provided.al2

FunctionArchitectures:
Type: String
Description: Architectures for the lambda function, allowd values are arm64 or x86_64
Default: 'arm64'
AllowedValues:
- arm64
- x86_64

SNSTopicArn:
Type: String
Description: The ARN for the SNS topic that contains the SNS subscription responsible for retrieving logs from Amazon S3
# placeholder value to avoid cfn-lint issues
Default: 'arn:aws:sns:us-east-1:123456789012:placeholder'

SQSTopicArn:
Type: String
Description: The ARN for the SQS topic that contains the SQS subscription responsible for retrieving logs from Amazon S3
# placeholder value to avoid cfn-lint issues
Default: 'arn:aws:sqs:us-east-1:123456789012:placeholder'

SQSIntegrationTopicArn:
Type: String
Description: The ARN of SQS topic to subscribe to retrieving messages
# placeholder value to avoid cfn-lint issues
Default: 'arn:aws:sqs:us-east-1:123456789012:placeholder'

SNSIntegrationTopicArn:
Type: String
Description: The ARN of SNS topic to subscribe to retrieving messages
# placeholder value to avoid cfn-lint issues
Default: 'arn:aws:sns:us-east-1:123456789012:placeholder'

KinesisStreamArn:
Type: String
Description: The ARN of Kinesis stream to subscribe to retrieving messages
Default: ''

IntegrationType:
Type: String
Description: 'The integration type. Can be one of: S3, CloudTrail, VpcFlow, CloudWatch, S3Csv, Sns, Sqs, Kinesis, CloudFront, Kafka, MSK, EcrScan'
Expand Down Expand Up @@ -538,12 +563,13 @@ Resources:
Type: AWS::Serverless::Function
Metadata:
SamResourceId: LambdaFunction
BuildMethod: makefile
Properties:
Description: Send logs to Coralogix.
Handler: bootstrap
Runtime: provided.al2023
Runtime: !Ref FunctionRunTime
Architectures:
- arm64
- !Ref FunctionArchitectures
MemorySize: !Ref FunctionMemorySize
Timeout: !Ref FunctionTimeout
CodeUri: .
Expand Down
Loading