-
Notifications
You must be signed in to change notification settings - Fork 80
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>
296899b
to
f815a51
Compare
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.