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

fix(core): respect custom proxy_access_log #12073

Merged
merged 6 commits into from
Nov 28, 2023

Conversation

outsinre
Copy link
Contributor

@outsinre outsinre commented Nov 21, 2023

Summary

Kong now has a fixed access log format kong_log_format that prevents customization. Introduced by #11663.

Resolves #12061.

If the proxy_access_log has a log format specified, then replace kong_log_format with the custom value.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • [n/a] There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Full changelog

  • replace kong_log_format with custom value set by end users.
  • update tests to be more robust.

Issue reference

Fix #FTI-5580

@outsinre outsinre requested review from dndx and samugi November 21, 2023 08:12
@outsinre outsinre force-pushed the FTI-5580/respect-custom-access-log branch from 316fd43 to 989e307 Compare November 21, 2023 08:14
@outsinre outsinre force-pushed the FTI-5580/respect-custom-access-log branch from 989e307 to 4df129e Compare November 21, 2023 13:16
@outsinre outsinre changed the title fix(core): respect custom proxy_access_log fix(core): respect custom proxy_access_log fix #12061 Nov 21, 2023
@outsinre outsinre changed the title fix(core): respect custom proxy_access_log fix #12061 fix(core): respect custom proxy_access_log Nov 21, 2023
@outsinre outsinre force-pushed the FTI-5580/respect-custom-access-log branch from 4df129e to d03245e Compare November 21, 2023 15:09
@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 21, 2023
@outsinre outsinre force-pushed the FTI-5580/respect-custom-access-log branch 2 times, most recently from b6fa973 to e61dac3 Compare November 22, 2023 02:43
@outsinre
Copy link
Contributor Author

A similar bug to #11712.

@outsinre outsinre requested review from ADD-SP and removed request for dndx November 22, 2023 02:44
@outsinre outsinre force-pushed the FTI-5580/respect-custom-access-log branch from e61dac3 to 6a03c7c Compare November 22, 2023 15:03
Kong now has a fixed access log format `kong_log_format`
that prevents customization and error on `kong start`.
Related to #11663.

If the `proxy_access_log` is not a valid pathname, then
replace `kong_log_format` with the custom value.
@outsinre outsinre force-pushed the FTI-5580/respect-custom-access-log branch from 6a03c7c to 6381b5c Compare November 22, 2023 15:04
@outsinre outsinre requested a review from samugi November 22, 2023 15:10
@outsinre outsinre requested a review from samugi November 24, 2023 03:38
compile_env.proxy_access_log_enabled = true
end
if kong_proxy_access_log then
-- example: 'logs/some-file.log apigw_json'
Copy link
Member

Choose a reason for hiding this comment

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

-- example: proxy_access_log = logs/some-file.log apigw_json

is it more clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

kong/cmd/utils/prefix_handler.lua Outdated Show resolved Hide resolved
Copy link
Member

@samugi samugi left a comment

Choose a reason for hiding this comment

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

LGTM, a couple of minor comments on the tests.

spec/01-unit/04-prefix_handler_spec.lua Outdated Show resolved Hide resolved
spec/01-unit/04-prefix_handler_spec.lua Show resolved Hide resolved
Copy link
Member

@tzssangglass tzssangglass left a comment

Choose a reason for hiding this comment

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

LGTM

@samugi samugi merged commit 9ec3494 into master Nov 28, 2023
24 checks passed
@samugi samugi deleted the FTI-5580/respect-custom-access-log branch November 28, 2023 09:27
team-gateway-bot pushed a commit that referenced this pull request Nov 28, 2023
* fix(core): respect custom proxy_access_log

Kong now has a fixed access log format `kong_log_format`
that prevents customization and error on `kong start`.
Related to #11663.

If the `proxy_access_log` is not a valid pathname, then
replace `kong_log_format` with the custom value.

* fix(config): cover log_format name with hyphen

* fix(config): early error when access log format is not defined

* fix(config): discard warning or return nil

* chore(config): style and comments

* chore(*): comments

(cherry picked from commit 9ec3494)
@team-gateway-bot
Copy link
Collaborator

The backport to release/3.4.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/3.4.x release/3.4.x
# Navigate to the new working tree
cd .worktrees/backport-release/3.4.x
# Create a new branch
git switch --create backport-12073-to-release/3.4.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 9ec3494cb558ee03223218c7c74003f8bce3b267
# Push it to GitHub
git push --set-upstream origin backport-12073-to-release/3.4.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/3.4.x

Then, create a pull request where the base branch is release/3.4.x and the compare/head branch is backport-12073-to-release/3.4.x.

@team-gateway-bot
Copy link
Collaborator

The backport to release/2.8.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/2.8.x release/2.8.x
# Navigate to the new working tree
cd .worktrees/backport-release/2.8.x
# Create a new branch
git switch --create backport-12073-to-release/2.8.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 9ec3494cb558ee03223218c7c74003f8bce3b267
# Push it to GitHub
git push --set-upstream origin backport-12073-to-release/2.8.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/2.8.x

Then, create a pull request where the base branch is release/2.8.x and the compare/head branch is backport-12073-to-release/2.8.x.

outsinre added a commit that referenced this pull request Nov 28, 2023
* fix(core): respect custom proxy_access_log

Kong now has a fixed access log format `kong_log_format`
that prevents customization and error on `kong start`.
Related to #11663.

If the `proxy_access_log` is not a valid pathname, then
replace `kong_log_format` with the custom value.

* fix(config): cover log_format name with hyphen

* fix(config): early error when access log format is not defined

* fix(config): discard warning or return nil

* chore(config): style and comments

* chore(*): comments
fffonion pushed a commit that referenced this pull request Nov 29, 2023
* fix(core): respect custom proxy_access_log

Kong now has a fixed access log format `kong_log_format`
that prevents customization and error on `kong start`.
Related to #11663.

If the `proxy_access_log` is not a valid pathname, then
replace `kong_log_format` with the custom value.

* fix(config): cover log_format name with hyphen

* fix(config): early error when access log format is not defined

* fix(config): discard warning or return nil

* chore(config): style and comments

* chore(*): comments

(cherry picked from commit 9ec3494)
fffonion pushed a commit that referenced this pull request Nov 29, 2023
* fix(core): respect custom proxy_access_log

Kong now has a fixed access log format `kong_log_format`
that prevents customization and error on `kong start`.
Related to #11663.

If the `proxy_access_log` is not a valid pathname, then
replace `kong_log_format` with the custom value.

* fix(config): cover log_format name with hyphen

* fix(config): early error when access log format is not defined

* fix(config): discard warning or return nil

* chore(config): style and comments

* chore(*): comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overriding proxy_access_log with different log_format no longer works in Kong 3.5.0
4 participants