You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "tylitianrui (via GitHub)" <gi...@apache.org> on 2023/04/28 12:36:12 UTC

[GitHub] [apisix] tylitianrui opened a new pull request, #9396: feat: route name recorded in access.log

tylitianrui opened a new pull request, #9396:
URL: https://github.com/apache/apisix/pull/9396

   ### Description
   In the log file, there is no flag to indicate which route configuration is working ,when multiple same paths with different priorities exist. It is necessary to record the route name.
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #9396: feat: route name recorded in access.log

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on code in PR #9396:
URL: https://github.com/apache/apisix/pull/9396#discussion_r1186648709


##########
conf/config-default.yaml:
##########
@@ -195,7 +195,7 @@ nginx_config:                     # config for render the template to generate n
   http:
     enable_access_log: true         # enable access log or not, default true
     access_log: logs/access.log
-    access_log_format: "$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\""
+    access_log_format: "$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $route_name $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\""
     access_log_format_escape: default       # allows setting json or default characters escaping in variables

Review Comment:
   The `$route_name` is not recommended, because it may be duplicated.
   We don't need to consider the apisix-dashboard project, this project is intended for beginners only and is not recommended for online environments.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on pull request #9396: feat: route name recorded in access.log

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on PR #9396:
URL: https://github.com/apache/apisix/pull/9396#issuecomment-1549177526

   I will close this PR, please feel free to reopen it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on a diff in pull request #9396: feat: route name recorded in access.log

Posted by "soulbird (via GitHub)" <gi...@apache.org>.
soulbird commented on code in PR #9396:
URL: https://github.com/apache/apisix/pull/9396#discussion_r1184464169


##########
conf/config-default.yaml:
##########
@@ -195,7 +195,7 @@ nginx_config:                     # config for render the template to generate n
   http:
     enable_access_log: true         # enable access log or not, default true
     access_log: logs/access.log
-    access_log_format: "$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\""
+    access_log_format: "$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $route_name $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\""
     access_log_format_escape: default       # allows setting json or default characters escaping in variables

Review Comment:
   Modifying the default log format will introduce a new break change, and not everyone needs to log route_name, as far as I know, most people use route_id
   
   So I think you can add this variable and then use it in your own config.yaml



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 closed pull request #9396: feat: route name recorded in access.log

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 closed pull request #9396: feat: route name  recorded  in  access.log
URL: https://github.com/apache/apisix/pull/9396


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tylitianrui commented on a diff in pull request #9396: feat: route name recorded in access.log

Posted by "tylitianrui (via GitHub)" <gi...@apache.org>.
tylitianrui commented on code in PR #9396:
URL: https://github.com/apache/apisix/pull/9396#discussion_r1185023400


##########
conf/config-default.yaml:
##########
@@ -195,7 +195,7 @@ nginx_config:                     # config for render the template to generate n
   http:
     enable_access_log: true         # enable access log or not, default true
     access_log: logs/access.log
-    access_log_format: "$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\""
+    access_log_format: "$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $route_name $request_time \"$http_referer\" \"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\""
     access_log_format_escape: default       # allows setting json or default characters escaping in variables

Review Comment:
   I partially agree.
    route_id is not human-readable. it is  not  easy to  find  out the relevant route configuration by route_id in apisix-dashboard. So i think  route_name is  better than route_id.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org