Skip to content

Commit 4226e82

Browse files
James96315James Ma
andauthored
Update to version v2.2.2 (#306)
* Update to version v2.1.1 * Update version to v2.2.1 * Update version to v2.2.2 --------- Co-authored-by: James Ma <[email protected]>
1 parent 876df63 commit 4226e82

File tree

31 files changed

+265
-130
lines changed

31 files changed

+265
-130
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.2.2] - 2024-08-23
9+
10+
### Changed
11+
12+
- Support editing the auto-generated Regular Expression of Nginx and Apache log in the Log Config. #301
13+
- Adjusted the error logs from info level to error level in the log-processor function. #305
14+
15+
### Fixed
16+
17+
- Fixed failed to retrieve instance status due to too many instances in the Instance Group details page. #298
18+
- Remove the redundant sign in alert dialog modal when user session expired. #303
19+
- Fixed the Grafana url validation failed with spaces when import a Grafana Server. #304
20+
821
## [2.2.1] - 2024-07-22
922

1023
### Added

source/constructs/lambda/api/app_log_ingestion/flb/flb_builder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,11 @@ def _get_flb_params(self):
331331
WithDecryption=True,
332332
)["Parameter"]["Value"]
333333

334+
storage_total_limit_size = ssm_cli.get_parameter(
335+
Name=f"/{stack_prefix}/FLB/storage_total_limit_size",
336+
WithDecryption=True,
337+
)["Parameter"]["Value"]
338+
334339
flb_params = {
335340
"log_level": log_level,
336341
"flush": flush,
@@ -342,6 +347,7 @@ def _get_flb_params(self):
342347
"store_dir_limit_size": store_dir_limit_size,
343348
"storage_type": storage_type,
344349
"storage_pause_on_chunks_overlimit": storage_pause_on_chunks_overlimit,
350+
"storage_total_limit_size": storage_total_limit_size,
345351
}
346352
return flb_params
347353

source/constructs/lambda/api/app_log_ingestion/flb/flb_template/pipeline.conf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
{% endif %}
179179
{{placeholder}} Retry_Limit {{ssm_params.retry_limit}}
180180
{{placeholder}} Role_arn {{item.role_arn}}
181+
{{placeholder}} storage.total_limit_size {{ssm_params.storage_total_limit_size}}
181182
{{placeholder}}
182183
{% elif item.output_name=='MSK' %}
183184
{{placeholder}}[OUTPUT]
@@ -194,6 +195,7 @@
194195
{{placeholder}} rdkafka.compression.type snappy
195196
{{placeholder}} rdkafka.security.protocol plaintext
196197
{{placeholder}} Retry_Limit {{ssm_params.retry_limit}}
198+
{{placeholder}} storage.total_limit_size {{ssm_params.storage_total_limit_size}}
197199
{{placeholder}}
198200
{% elif item.output_name=='S3' %}
199201
{{placeholder}}[OUTPUT]
@@ -204,7 +206,9 @@
204206
{{placeholder}} region {{item.region_name}}
205207
{{placeholder}} total_file_size {{item.s3.max_file_size}}M
206208
{{placeholder}} upload_timeout {{item.s3.upload_timeout}}s
207-
{{placeholder}} store_dir_limit_size {{ssm_params.store_dir_limit_size}}
209+
{{placeholder}} #store_dir_limit_size {{ssm_params.store_dir_limit_size}}
210+
{{placeholder}} #FluentBit version 2.0 and above, please use the store_dir_limit_size parameter. Don't use storage.total_limit_size
211+
{{placeholder}} storage.total_limit_size {{ssm_params.store_dir_limit_size}}
208212
{{placeholder}} use_put_object true
209213
{% if item.s3.compression_type | lower == "gzip" %}
210214
{{placeholder}} s3_key_format /{{item.s3.prefix}}/%Y-%m-%d-%H-%M-%S-$UUID.gz
@@ -235,7 +239,7 @@
235239
{{placeholder}} AWS_Auth On
236240
{{placeholder}} TLS On
237241
{{placeholder}} Suppress_Type_Name On
238-
{{placeholder}} Buffer_Size 20M
242+
{{placeholder}} Buffer_Size 50M
239243
{{placeholder}} #When enabled, generate _id for outgoing records. This prevents duplicate records when retrying.
240244
{{placeholder}} Generate_ID On
241245
{{placeholder}} Logstash_Format Off
@@ -244,6 +248,7 @@
244248
{{placeholder}} Time_Key_Nanos Off
245249
{{placeholder}} Write_Operation create
246250
{{placeholder}} AWS_Role_ARN {{item.role_arn}}
251+
{{placeholder}} storage.total_limit_size {{ssm_params.storage_total_limit_size}}
247252
{{placeholder}}
248253
{% endif %}
249254
{% endwith %}

source/constructs/lambda/api/app_log_ingestion/test/test_flb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ def mock_ssm_context():
7676
Type="String",
7777
)
7878

79+
ssm_client.put_parameter(
80+
Name=f"/{stack_prefix}/FLB/storage_total_limit_size",
81+
Value="off",
82+
Type="String",
83+
)
84+
7985
yield
8086

8187

source/constructs/lambda/pipeline/log-processor/idx/idx_svc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,13 @@ def run_func_with_retry(
9191
break
9292
logger.error("%s failed: %s", func_name, response.text)
9393
if response.status_code == 403 or response.status_code == 409:
94-
logger.info(
95-
"Please add access to OpenSearch for this Lambda and rerun this"
96-
)
94+
logger.info("Please add access to OpenSearch for this Lambda")
9795
if response.status_code == 403:
96+
logger.error(
97+
"the last response code is %d, the last response content is %s",
98+
response.status_code,
99+
response.content,
100+
)
98101
self.map_backend_role()
99102
raise APIException(
100103
ErrorCode.UNKNOWN_ERROR,
@@ -107,7 +110,7 @@ def run_func_with_retry(
107110
func_name,
108111
retry,
109112
)
110-
logger.info(
113+
logger.error(
111114
"the last response code is %d, the last response content is %s",
112115
response.status_code,
113116
response.content,

source/constructs/lambda/pipeline/log-processor/idx/opensearch_client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ def create_ism_policy(
120120
response = requests.put(
121121
url, auth=self._awsauth, json=policy_doc, timeout=30
122122
)
123-
logger.info("--> update ism policy response code %d", response.status_code)
123+
logger.error("--> update ism policy response code %d", response.status_code)
124124
return response
125-
logger.info(
125+
logger.error(
126126
"the last response code is %d, the last response content is %s",
127127
response.status_code,
128128
response.content,
@@ -348,6 +348,12 @@ def add_master_role(self, role_arn: str):
348348
status_code = resp["ResponseMetadata"]["HTTPStatusCode"]
349349
logger.info("Response status: %d", status_code)
350350
if status_code not in (200, 201):
351+
logger.error(
352+
"Add backend role %s to domain %s, response status: %d",
353+
role_arn,
354+
domain_name,
355+
status_code,
356+
)
351357
raise APIException(
352358
ErrorCode.UNKNOWN_ERROR,
353359
"Failed to add backend role {role_arn} to domain {domain_name}",

source/constructs/lambda/pipeline/log-processor/lambda_function.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def handle_sqs_retries(record):
7171
"This message has exceeded the maximum number of retries, verify that you can connect to OpenSearch or that the data type does not match the field type defined for the index",
7272
)
7373
else:
74-
raise Exception(f"Error processing SQS message: {record}")
74+
raise Exception(
75+
f"Error processing SQS message: {record}, Lambda function has been called {approximate_receive_count} times, the message will be re-consumed and then retried!"
76+
)
7577

7678

7779
def change_sqs_message_visibility(event_record):

source/constructs/lib/api/app-log-ingestion-stack.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,6 @@ export class AppLogIngestionStack extends Construct {
122122
description:
123123
'Download Fluent-Bit config file and reboot the Fluent-Bit',
124124
parameters: {
125-
ARCHITECTURE: {
126-
type: "String",
127-
default: "",
128-
description: "(Required) Machine Architecture"
129-
},
130125
INSTANCEID: {
131126
type: 'String',
132127
default: '',
@@ -146,7 +141,7 @@ export class AppLogIngestionStack extends Construct {
146141
name: "updateFluentBitVersion",
147142
inputs: {
148143
runCommand: [
149-
`[ -e /opt/fluent-bit/bin/fluent-bit ] && [ -z \"$(/opt/fluent-bit/bin/fluent-bit -V | grep '${FluentBitVersion}')\" ] && curl -o /opt/fluent-bit{{ARCHITECTURE}}.tar.gz 'https://${flb_s3_addr}/clo/${process.env.VERSION}/aws-for-fluent-bit/fluent-bit{{ARCHITECTURE}}.tar.gz' && tar xzvf /opt/fluent-bit{{ARCHITECTURE}}.tar.gz -C /opt/ --exclude=fluent-bit/etc; echo 0`
144+
`ARCHITECTURE=''; if [ \"$(uname -m)\" = \"aarch64\" ]; then ARCHITECTURE='-arm64'; fi; [ -e /opt/fluent-bit/bin/fluent-bit ] && [ -z \"$(/opt/fluent-bit/bin/fluent-bit -V | grep '${FluentBitVersion}')\" ] && curl -o /opt/fluent-bit$ARCHITECTURE.tar.gz https://${flb_s3_addr}/clo/${process.env.VERSION}/aws-for-fluent-bit/fluent-bit$ARCHITECTURE.tar.gz && tar xzvf /opt/fluent-bit$ARCHITECTURE.tar.gz -C /opt/ --exclude=fluent-bit/etc; echo 0`
150145
]
151146
},
152147
},

source/constructs/lib/api/fluent-bit-config-stack.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class FluentBitConfigStack extends Construct {
6767
});
6868
new ssm.StringParameter(this, "FlbBufferSizeParameter", { //NOSONAR
6969
parameterName: `/${props.stackPrefix}/FLB/buffer_size`,
70-
description: "Set the buffer size for HTTP client when reading responses from Kubernetes API server. A value of 0 results in no limit, and the buffer will expand as-needed.",
70+
description: "Set the buffer size for HTTP client when reading responses from Kubernetes API server and the buffer size to read data in INPUT plugin. A value of 0 results in no limit, and the buffer will expand as-needed.",
7171
stringValue: "0",
7272
});
7373
new ssm.StringParameter(this, "FlbRetryLimitParameter", { //NOSONAR
@@ -90,6 +90,11 @@ export class FluentBitConfigStack extends Construct {
9090
description: "This parameter is to specifies if file storage is to be paused when reaching the chunk limit. Default is off",
9191
stringValue: "off",
9292
});
93+
new ssm.StringParameter(this, "FlbStorageTotalLimitSizeParameter", { //NOSONAR
94+
parameterName: `/${props.stackPrefix}/FLB/storage_total_limit_size`,
95+
description: "This parameter is to limit the maximum number of Chunks in the filesystem for the current output logical destination. Default is 500M",
96+
stringValue: "500M",
97+
});
9398

9499

95100

source/constructs/lib/api/instance-stack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ export class InstanceStack extends Construct {
374374
runtime: lambda.Runtime.PYTHON_3_11,
375375
handler: 'lambda_function.lambda_handler',
376376
timeout: Duration.minutes(5),
377-
memorySize: 4096,
377+
memorySize: 1024,
378378
logFormat: "JSON",
379379
applicationLogLevel: "INFO",
380380
systemLogLevel: "WARN",

0 commit comments

Comments
 (0)