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

Bucket_logging: Change log object name format. #8128

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

aspandey
Copy link
Contributor

At present we are creating log objects and giving them name based on log_prefix and log_bucket.

There are some constraint to that and one is that a user can set same log bucket and log prefix for two different source buckets. That will cause logs from two different source buckets to go to same log objects.

In addition to that, source bucket name in log file name will help to get it easily without processing log file.

This source bucket name can be used to get more logging configuration, which can be helpful in further processing.

Note: As we are not providing log_prefix in log object name, it should be retrieved and processed from system_store by bg service at the time of uploading objects on log bucket.

Copy link
Contributor

@jackyalbo jackyalbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 101 to 111
if [[ "$log_field" =~ "log_bucket" ]]; then
IFS=: read -r -a log_values <<< "$log_field"
log_bucket_name=$(echo "${log_values[1]}" | tr -d '"' | sed 's/^[ \t]*//; s/[ \t]*$//')
continue
fi

if [[ "$log_field" =~ "log_prefix" ]]; then
IFS=: read -r -a prefix_values <<< "$log_field"
log_prefix_value=$(echo "${prefix_values[1]}" | tr -d '"' | sed 's/^[ \t]*//; s/[ \t]*$//')
if [[ "$log_field" =~ "source_bucket" ]]; then
IFS=: read -r -a source_values <<< "$log_field"
source_bucket_name=$(echo "${source_values[1]}" | tr -d '"' | sed 's/^[ \t]*//; s/[ \t]*$//')
continue
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to duplicate it?
can't it be a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be a function. I modified the code and can see that it is working. However, I find the current code more readable and less prone to errors. Moreover, we are not saving any lines of code; all it is doing is adding more complexity to understand the code.

At present we are creating log objects and giving them
name based on log_prefix and log_bucket.

There are some constraint to that and one is that a user
can set same log bucket and log prefix for two different
source buckets. That will cause logs from two different source
buckets to go to same log objects.

In addition to that, source bucket name in log file name will
help to get it easily without processing log file.

This source bucket name can be used to get more logging configuration,
which can be helpful in further processing.

Signed-off-by: Ashish Pandey <aspandey@redhat.com>
@aspandey aspandey force-pushed the change-log-object-name branch from 296899b to f815a51 Compare June 18, 2024 08:42
@aspandey aspandey merged commit 967ab61 into noobaa:master Jun 19, 2024
10 checks passed
@aspandey aspandey deleted the change-log-object-name branch June 19, 2024 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants