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

Add support for Extended Log Format #1304

Merged
merged 7 commits into from
Feb 27, 2023

Conversation

greg65236592
Copy link
Contributor

Add support for Extended Log Format(ELF)

Description

Adding support for Extended Log Format(ELF).
From Wikipedia: ELF is a standardised text file format, like Common Log Format (CLF), that is used by web servers when generating log files, but ELF files provide more information and flexibility.
ELF is also described in W3C.

Motivation and Context

Logbook usually separates the logging of request and response like described, except for Common Log Format.

In some cases, we might want use tools to query or analyze server logs, and it could be much easier to get it done if we could print the request and response log in one row.

CommonsLogFormatSink is the only one that can do this among all sinks. If we like to print other fields like request time taken, or some special header values, CLF is unable to provide such information.

Thus, I would like to bring in Extended Log Format(ELF) for extending the CLF, which allows users to customize log fields, and outputs the request and response information together in the same row.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.


class RemoteResponseTest {

@Test
void statusCanThrow() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason why this test was removed?

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 was removed due to the dependency upgrade. I have reverted this commit at 2a16738 to see if it can pass the build.

* @see <a href="https://docs.oracle.com/cd/A97329_03/bi.902/a90500/admin-05.htm#634823">Oracle analytical tool log
* parsing description</a>
*/
private enum Field {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nicer if this enum not only holds the field name, but also the logic (as a lambda) how to extract the information. That way the field name and its implementation would be very close to each other. It would also remove the need for the lcoal variables with the comments above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice suggestion. Since the logic of getting field values requires data from several places, such as request and response, I have to encapsulate those objects into FieldParameter for the lambda usage, please see if that fits. 4543589

@greg65236592
Copy link
Contributor Author

Thanks for reviewing! All comments should be addressed now.

@DaniloVeljovic
Copy link
Member

Looks good to me 👍🏼 Let's just fix the build, and we should be able to merge it now

@greg65236592
Copy link
Contributor Author

Looks like the issue: jeremylong/DependencyCheck#5502 is not resolved yet, add a suppression to pass the build.

@DaniloVeljovic
Copy link
Member

👍🏼

@DaniloVeljovic DaniloVeljovic merged commit 32a8ac0 into zalando:main Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants