Skip to content

Conversation

@TaeyeongKwak
Copy link
Contributor

Description

This PR adds path support to the file-logger plugin metadata, allowing a default log file path to be configured globally via plugin_metadata and used when an individual plugin config does not specify path.

For example, a user can set a path through plugin metadata, as below:

curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/file-logger \
-H "X-API-KEY: $admin_key" -X PUT -d '
{
    "path": "logs/metadata-file.log"
}'

As above, if the path properties exists in the plugin metadata, you can exclude the path properties of the file-logger plugin when setting the route.

curl http://127.0.0.1:9180/apisix/admin/routes/1 \
-H "X-API-KEY: $admin_key" -X PUT -d '                                                                                                                                                                                                          
{
    "uri": "/hello",
    "plugins": {
        "file-logger": {}                                                                                                                                                                                                                             
    },
    "upstream": {
        "nodes": { "127.0.0.1:8000": 1 }
    }                                                                                                                                                                                                                                               
}'

Checklist

  • I have explained the need for this PR and the problem it solves
  • 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 first)

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Dec 19, 2025
Baoyuantop
Baoyuantop previously approved these changes Dec 22, 2025
AlinsRan
AlinsRan previously approved these changes Dec 25, 2025
return metadata.value.path
end

return nil, "property \"path\" is required"
Copy link
Contributor

Choose a reason for hiding this comment

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

We have removed required = {"path"}, but it returns is required when path is empty. can we add something like neither the metadata nor the conf is configured

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @TaeyeongKwak, I submitted a suggested change and committed suggestion for this comment, but it seems the error message in the test also needs to be fixed. Could you please help me with that? It's located in t/plugin/file-logger.t. (TEST 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Baoyuantop, I’ve fixed the error message in the test you mentioned.

ronething
ronething previously approved these changes Dec 25, 2025
Copy link
Contributor

@ronething ronething left a comment

Choose a reason for hiding this comment

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

others lgtm.

@Baoyuantop Baoyuantop dismissed stale reviews from ronething, AlinsRan, and themself via 2ccf531 December 25, 2025 09:58
@Baoyuantop Baoyuantop added wait for update wait for the author's response in this issue/PR and removed awaiting review labels Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files. wait for update wait for the author's response in this issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants