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

Log tracing #652

Merged
merged 4 commits into from
Aug 23, 2023
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
2 changes: 1 addition & 1 deletion jobs/uaa/templates/config/log4j2.properties.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ case logging_format_timestamp_value
end
%>
property.log_directory = /var/vcap/sys/log/uaa
property.log_pattern=[<%= timestamp_format %>] uaa%X{context} - %pid [%t] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n
property.log_pattern=[<%= timestamp_format %>] uaa%X{context} - %pid [%t] - [%X{traceId},%X{spanId}] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n
swalchemist marked this conversation as resolved.
Show resolved Hide resolved

appender.uaaDefaultAppender.type = File
appender.uaaDefaultAppender.name = UaaDefaultAppender
Expand Down
2 changes: 1 addition & 1 deletion spec/compare/all-properties-set-log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dest = err
name = UaaLog

property.log_directory = /var/vcap/sys/log/uaa
property.log_pattern=[%d{yyyy-MM-dd'T'HH:mm:ss.nnnnnn}{GMT+0}Z] uaa%X{context} - %pid [%t] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n
property.log_pattern=[%d{yyyy-MM-dd'T'HH:mm:ss.nnnnnn}{GMT+0}Z] uaa%X{context} - %pid [%t] - [%X{traceId},%X{spanId}] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n

appender.uaaDefaultAppender.type = File
appender.uaaDefaultAppender.name = UaaDefaultAppender
Expand Down
2 changes: 1 addition & 1 deletion spec/compare/default-log4j2-template.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dest = err
name = UaaLog

property.log_directory = /var/vcap/sys/log/uaa
property.log_pattern=[EXPECTED_LOG_PATTERN_PLACEHOLDER] uaa%X{context} - %pid [%t] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n
property.log_pattern=[EXPECTED_LOG_PATTERN_PLACEHOLDER] uaa%X{context} - %pid [%t] - [%X{traceId},%X{spanId}] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n

appender.uaaDefaultAppender.type = File
appender.uaaDefaultAppender.name = UaaDefaultAppender
Expand Down
2 changes: 1 addition & 1 deletion spec/compare/default-log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dest = err
name = UaaLog

property.log_directory = /var/vcap/sys/log/uaa
property.log_pattern=[%d{yyyy-MM-dd'T'HH:mm:ss.nnnnnn}{GMT+0}Z] uaa%X{context} - %pid [%t] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n
property.log_pattern=[%d{yyyy-MM-dd'T'HH:mm:ss.nnnnnn}{GMT+0}Z] uaa%X{context} - %pid [%t] - [%X{traceId},%X{spanId}] .... %5p --- %c{1}: %replace{%m}{(?<=password=|client_secret=)([^&]*)}{<redacted>}%n

appender.uaaDefaultAppender.type = File
appender.uaaDefaultAppender.name = UaaDefaultAppender
Expand Down
12 changes: 9 additions & 3 deletions src/acceptance_tests/uaa-release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,12 @@ var _ = Describe("UaaRelease", func() {

})

logLineWithoutTimestampRegex := ` uaa.* - \d+ \[([^]]+)\] .... (DEBUG|\sINFO|\sWARN) --- .+: .+`
logLineWithoutTimestampRegex := ` uaa.* - \d+ \[([^]]+)\] - \[[^]]+\] .... (DEBUG|\sINFO|\sWARN) --- .+: .+`

DescribeTable("UAA log format", func(uaaLogFormat string, optFiles ...string) {
DescribeTable("UAA log format", func(
uaaLogFormat string,
optFiles ...string,
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather not see this kind of reformatting as part of the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, interesting. For Go, the reformatting is usually automatic and something that's very difficult to suppress. So the code this was changed probably wasn't changed with an IDE.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's coming from the IDE, and they aren't intended line changes, they can can be unselected.

deployUAA(optFiles...)

logPath := scpUAALog()
Expand Down Expand Up @@ -292,7 +295,10 @@ func scpUaaAuditLog() string {
return localUAALogPath
}

func getFingerPrint(certdata []byte) (string, error) {
func getFingerPrint(certdata []byte) (
string,
error,
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The same. I'd rather not see this kind of reformatting as part of the PR.

var block *pem.Block
block, _ = pem.Decode(certdata)

Expand Down