You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/11/21 04:43:02 UTC

[GitHub] [apisix] tzssangglass opened a new pull request, #8366: fix(log-rotate): max_kept works on compression files

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

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes #8343
   
   ### 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
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] 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] spacewander commented on a diff in pull request #8366: fix(log-rotate): max_kept works on compression files

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #8366:
URL: https://github.com/apache/apisix/pull/8366#discussion_r1028935824


##########
t/plugin/log-rotate2.t:
##########
@@ -173,3 +176,35 @@ plugin_attr:
     }
 --- response_body
 passed
+
+
+
+=== TEST 5: max_kept effective on compression files
+--- extra_yaml_config
+plugins:
+  - log-rotate
+plugin_attr:
+  log-rotate:
+    interval: 1
+    max_kept: 1
+    enable_compression: true
+--- config
+    location /t {
+        content_by_lua_block {
+            ngx.sleep(3.5)
+            local has_split_access_file = false
+            local has_split_error_file = false
+            local lfs = require("lfs")
+            local count = 0
+            for file_name in lfs.dir(ngx.config.prefix() .. "/logs/") do
+                if string.match(file_name, ".tar.gz$") then
+                    count = count + 1
+                end
+            end
+            --- only two compression file, access.log.tar.gz and error.log.tar.gz

Review Comment:
   The compression file should be named with a timestamp?



-- 
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 #8366: fix(log-rotate): max_kept works on compression files

Posted by GitBox <gi...@apache.org>.
soulbird commented on code in PR #8366:
URL: https://github.com/apache/apisix/pull/8366#discussion_r1028740075


##########
t/plugin/log-rotate2.t:
##########
@@ -173,3 +176,36 @@ plugin_attr:
     }
 --- response_body
 passed
+
+
+
+=== TEST 5: max_kept effective on compression files
+--- extra_yaml_config
+plugins:
+  - log-rotate
+plugin_attr:
+  log-rotate:
+    interval: 1
+    max_kept: 1
+    enable_compression: true
+--- config
+    location /t {
+        content_by_lua_block {
+            ngx.log(ngx.ERR, "start xxxxxx")

Review Comment:
   remove this ?
   



-- 
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] tzssangglass commented on a diff in pull request #8366: fix(log-rotate): max_kept works on compression files

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8366:
URL: https://github.com/apache/apisix/pull/8366#discussion_r1029035295


##########
t/plugin/log-rotate2.t:
##########
@@ -173,3 +176,35 @@ plugin_attr:
     }
 --- response_body
 passed
+
+
+
+=== TEST 5: max_kept effective on compression files
+--- extra_yaml_config
+plugins:
+  - log-rotate
+plugin_attr:
+  log-rotate:
+    interval: 1
+    max_kept: 1
+    enable_compression: true
+--- config
+    location /t {
+        content_by_lua_block {
+            ngx.sleep(3.5)
+            local has_split_access_file = false
+            local has_split_error_file = false
+            local lfs = require("lfs")
+            local count = 0
+            for file_name in lfs.dir(ngx.config.prefix() .. "/logs/") do
+                if string.match(file_name, ".tar.gz$") then
+                    count = count + 1
+                end
+            end
+            --- only two compression file, access.log.tar.gz and error.log.tar.gz

Review Comment:
   > The compression file should be named with a timestamp?
   
   The names of the compressed files actually contain timestamps, like `2022-11-22_16-50-37__access.log.tar.gz`, `2022-11-22_16-50-38__error.log.tar.gz`,  the comment is just to indicate that only two (timestamped) compressed files remain in this test condition.



-- 
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] spacewander merged pull request #8366: fix(log-rotate): max_kept works on compression files

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #8366:
URL: https://github.com/apache/apisix/pull/8366


-- 
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