How to get the country IP locations in the logs?

Hello :wave:
I have a problem to find the way to know the country of origin of the Internet users of my website.

The objective is to use the grafana-worldmap-panel plugin.

I have successfully run caddy-maxmind-geolocation but there are no logs in caddy.

Here is my config:

    @geofilter {
        not maxmind_geolocation {
            db_path "/etc/caddy/GeoLite2-Country.mmdb"
            allow_countries FR
    respond @geofilter 403
} {
	reverse_proxy localhost:9999
	log {
		format json
		output file /var/log/caddy/example-com.log {
			roll_size 1gb
			roll_keep 5
			roll_keep_for 720h

Do you have a lead or an idea to unblock me?

Thank you

Caddy doesn’t offer any way to add fields to the logs. Due to the way logging is done (for efficiency), it’s non-trivial to implement. You’ll need to use separate tooling to filter the logs and add the fields, if you need to. You can use something like jq to manipulate JSON logs.

This topic was automatically closed after 30 days. New replies are no longer allowed.