Skip to content

Commit

Permalink
V 1.0.1 (#68)
Browse files Browse the repository at this point in the history
* ECR Tests added

* add env variable to control architecture selection in Makefile

* added x86_64 build path to publish workflows

* added CpuArch Parameter and template values to synchronised template job

* fix bucket name

* add loggroup to metadata


---------

Co-authored-by: Shaun Remekie <[email protected]>
Co-authored-by: Concourse <[email protected]>
  • Loading branch information
3 people authored Mar 1, 2024
1 parent 0ced5d7 commit 9d4d3c0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog

## v1.0.1 / 2024-03-01
### 🚀 New components 🚀
- Added LogGroup Name to CloudWatch Metadata
- Added X86 support

## v1.0.0 🎉 / 2024-02-04
- GA release of Coralogix AWS Shipper

Expand Down
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.0"
version = "1.0.1"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ These are optional parameters if you wish to receive notification emails, exclud
| NotificationEmail | A failure notification will be sent to this email address. | | |
| BlockingPattern | 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. | | |
| SamplingRate | Send messages at a specific rate, such as 1 out of every N logs. For example, if your value is 10, a message will be sent for every 10th log. | 1 | :heavy_check_mark: |
| AddMetadata | Add metadata to the log message. Expects comma separated values. Options for S3 are `bucket_name`,`key_name`. For CloudWatch use `stream_name`. | | |
| AddMetadata | Add metadata to the log message. Expects comma separated values. Options for S3 are `bucket_name`,`key_name`. For CloudWatch use `stream_name`, `loggroup_name` . | | |

### Lambda Configuration (Optional)

Expand Down
10 changes: 9 additions & 1 deletion src/coralogix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ struct JsonMessage {
#[serde(skip_serializing_if = "Option::is_none")]
stream_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
loggroup_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
bucket_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
key_name: Option<String>,
Expand Down Expand Up @@ -132,6 +134,7 @@ fn convert_to_log_entry(
tracing::debug!("Sub Name: {}", &subsystem_name);
let severity = get_severity_level(&log);
let stream_name = metadata_instance.stream_name.clone();
let loggroup_name = metadata_instance.log_group.clone();
tracing::debug!("Severity: {:?}", severity);

let message = match serde_json::from_str(&log) {
Expand All @@ -142,6 +145,7 @@ fn convert_to_log_entry(
let mut message = JsonMessage {
message,
stream_name: None,
loggroup_name: None,
bucket_name: None,
key_name: None,
};
Expand All @@ -157,6 +161,10 @@ fn convert_to_log_entry(
message.stream_name = Some(metadata_instance.stream_name.clone());
tracing::debug!("Assigned stream_name: {}", metadata_instance.stream_name);
}
"loggroup_name" => {
message.loggroup_name = Some(metadata_instance.log_group.clone());
tracing::debug!("Assigned loggroup_name: {}", metadata_instance.log_group);
}
"bucket_name" => {
message.bucket_name = Some(metadata_instance.bucket_name.clone());
tracing::debug!("Assigned bucket_name: {}", metadata_instance.bucket_name);
Expand All @@ -171,7 +179,7 @@ fn convert_to_log_entry(
}
}

let body = if message.stream_name.is_some() || message.bucket_name.is_some() || message.key_name.is_some() {
let body = if message.stream_name.is_some() || message.loggroup_name.is_some() || message.bucket_name.is_some() || message.key_name.is_some() {
serde_json::to_value(&message).unwrap_or(message.message)
} else {
message.message
Expand Down
9 changes: 9 additions & 0 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub async fn s3(

let mut metadata_instance = Metadata {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
key_name: String::new(),
};
Expand Down Expand Up @@ -138,6 +139,7 @@ trait MetadataTrait {

pub struct Metadata {
pub stream_name: String,
pub log_group: String,
pub bucket_name: String,
pub key_name: String,
}
Expand All @@ -146,6 +148,7 @@ impl Default for Metadata {
fn default() -> Self {
Self {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
key_name: String::new(),
}
Expand All @@ -163,6 +166,7 @@ pub async fn kinesis_logs(
) -> Result<(), Error> {
let metadata_instance = Metadata {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
key_name: String::new(),
};
Expand Down Expand Up @@ -218,6 +222,7 @@ pub async fn sqs_logs(
) -> Result<(), Error> {
let metadata_instance = Metadata {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
key_name: String::new(),
};
Expand Down Expand Up @@ -250,6 +255,7 @@ pub async fn sns_logs(
) -> Result<(), Error> {
let metadata_instance = Metadata {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
key_name: String::new(),
};
Expand Down Expand Up @@ -282,6 +288,7 @@ pub async fn cloudwatch_logs(
) -> Result<(), Error> {
let mut metadata_instance = Metadata {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
key_name: String::new(),
};
Expand All @@ -302,6 +309,7 @@ pub async fn cloudwatch_logs(
let logs = match config.integration_type {
IntegrationType::CloudWatch => {
metadata_instance.stream_name = cloudwatch_event_log.data.log_stream.clone();
metadata_instance.log_group = cloudwatch_event_log.data.log_group.clone();
process_cloudwatch_logs(cloudwatch_event_log, config.sampling).await?
}
_ => {
Expand Down Expand Up @@ -334,6 +342,7 @@ pub async fn ecr_scan_logs(
) -> Result<(), Error> {
let metadata_instance = Metadata {
stream_name: String::new(),
log_group: String::new(),
bucket_name: String::new(),
key_name: String::new(),
};
Expand Down
2 changes: 1 addition & 1 deletion 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.0
SemanticVersion: 1.0.1
SourceCodeUrl: https://github.com/coralogix/coralogix-aws-shipper

AWS::CloudFormation::Interface:
Expand Down

0 comments on commit 9d4d3c0

Please sign in to comment.