Skip to content

Feature Request: Allow dynamic include_files based on user role or request context #37

@danish-khan-I

Description

@danish-khan-I

Hi 👋 First, thank you for the awesome Nova Logs Tool—it’s a really helpful addition for managing Laravel logs from the Nova interface!

📌 Feature Request
It would be great to have the ability to dynamically filter log files shown in the Logs Tool based on the logged-in Nova user (e.g., by role or permissions). Currently, the include_files option in the log-viewer.php config is static and does not support runtime evaluation.

🎯 Use Case
In multi-tenant or role-based systems, different user types (e.g., admin, dev, qa) should only have access to logs relevant to their role:

Admins see all logs (e.g., *.log)

Devs only see specific files (e.g., xyz-*.log)

QA might see sanitized error logs

💡 Suggested Implementation
One potential solution could be:

Allow the tool to accept dynamic filters via withMeta() or a callback.

Or, allow overriding the file list via a published method/hook or via Nova ToolServiceProvider.

Example idea:

(new LogsTool())
    ->withIncludeFilesCallback(function (User $user) {
        return $user->hasRole('admin') ? ['*.log'] : ['terraform*.log'];
    });

🙏 Final Thoughts
This would greatly enhance the flexibility and security of the Logs Tool in production environments. Happy to contribute a PR if you’re open to this idea!

Thanks again for your great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions