Skip to content

Dynamic file path for access log? #442

@hongquan

Description

@hongquan

I want to adopt Ferron in my company (after success with my personal website), but there is one blocker: dynamic file path for access log.

The idea is that, my company website can be reach via various domains. We want to track how much traffic a domain get, so we need to separate access log per domain. For example, here is what we do in Nginx:

include includes/bot_definition.conf;

server {
	server_name *.gomarkaz.com gomarkaz.com;

	# Required for dynamic log file path
	root /opt/Markaz/public/fake-roots/$host/;
	access_log /var/log/nginx/markaz/$host/access.log combined if=$is_not_bot;
	access_log /var/log/nginx/markaz/$host/bot_access.log combined if=$is_bot;
	# Error log doesn't support variables
	error_log /var/log/nginx/markaz/error.log;
}

If the /opt/Markaz/public/fake-roots/easyuni/ folder exists, all traffics to easyuni.gomarkaz.com will be logged to /var/log/nginx/markaz/easyuni.gomarkaz.com/access.log file. The root directive is to prevent arbitrary folder from being created in /var/log/nginx/markaz/.

I would love to see Ferron supporting this use case. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions