PascalMinder / geoblock

Traefik middleware plugin - Deny requests based on country of origin
98 stars 10 forks source link

Hiding geoblock log messages #41

Closed theAlevan closed 8 months ago

theAlevan commented 10 months ago

In my traefik deployment, despite setting log level to warn in traefik, and disabling log messages in geoblock, I still get these log messages, every ~30 seconds, making the log file harder to read:

INFO: GeoBlock: 2023/08/23 13:36:13 allow local IPs: true INFO: GeoBlock: 2023/08/23 13:36:13 log local requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log allowed requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log api requests: false INFO: GeoBlock: 2023/08/23 13:36:13 API uri: https://get.geojs.io/v1/ip/country/{ip} INFO: GeoBlock: 2023/08/23 13:36:13 API timeout: 150 INFO: GeoBlock: 2023/08/23 13:36:13 cache size: 15 INFO: GeoBlock: 2023/08/23 13:36:13 force monthly update: true INFO: GeoBlock: 2023/08/23 13:36:13 allow unknown countries: false INFO: GeoBlock: 2023/08/23 13:36:13 unknown country api response: nil INFO: GeoBlock: 2023/08/23 13:36:13 blacklist mode: false INFO: GeoBlock: 2023/08/23 13:36:13 add country header: false INFO: GeoBlock: 2023/08/23 13:36:13 countries: [DELETED] INFO: GeoBlock: 2023/08/23 13:36:13 allow local IPs: true INFO: GeoBlock: 2023/08/23 13:36:13 log local requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log allowed requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log api requests: false INFO: GeoBlock: 2023/08/23 13:36:13 API uri: https://get.geojs.io/v1/ip/country/{ip} INFO: GeoBlock: 2023/08/23 13:36:13 API timeout: 150 INFO: GeoBlock: 2023/08/23 13:36:13 cache size: 15 INFO: GeoBlock: 2023/08/23 13:36:13 force monthly update: true INFO: GeoBlock: 2023/08/23 13:36:13 allow unknown countries: false INFO: GeoBlock: 2023/08/23 13:36:13 unknown country api response: nil INFO: GeoBlock: 2023/08/23 13:36:13 blacklist mode: false INFO: GeoBlock: 2023/08/23 13:36:13 add country header: false INFO: GeoBlock: 2023/08/23 13:36:13 countries: [DELETED] INFO: GeoBlock: 2023/08/23 13:36:13 allow local IPs: true INFO: GeoBlock: 2023/08/23 13:36:13 log local requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log allowed requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log api requests: false INFO: GeoBlock: 2023/08/23 13:36:13 API uri: https://get.geojs.io/v1/ip/country/{ip} INFO: GeoBlock: 2023/08/23 13:36:13 API timeout: 150 INFO: GeoBlock: 2023/08/23 13:36:13 cache size: 15 INFO: GeoBlock: 2023/08/23 13:36:13 force monthly update: true INFO: GeoBlock: 2023/08/23 13:36:13 allow unknown countries: false INFO: GeoBlock: 2023/08/23 13:36:13 unknown country api response: nil INFO: GeoBlock: 2023/08/23 13:36:13 blacklist mode: false INFO: GeoBlock: 2023/08/23 13:36:13 add country header: false INFO: GeoBlock: 2023/08/23 13:36:13 countries: [DELETED] INFO: GeoBlock: 2023/08/23 13:36:13 allow local IPs: true INFO: GeoBlock: 2023/08/23 13:36:13 log local requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log allowed requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log api requests: false INFO: GeoBlock: 2023/08/23 13:36:13 API uri: https://get.geojs.io/v1/ip/country/{ip} INFO: GeoBlock: 2023/08/23 13:36:13 API timeout: 150 INFO: GeoBlock: 2023/08/23 13:36:13 cache size: 15 INFO: GeoBlock: 2023/08/23 13:36:13 force monthly update: true INFO: GeoBlock: 2023/08/23 13:36:13 allow unknown countries: false INFO: GeoBlock: 2023/08/23 13:36:13 unknown country api response: nil INFO: GeoBlock: 2023/08/23 13:36:13 blacklist mode: false INFO: GeoBlock: 2023/08/23 13:36:13 add country header: false INFO: GeoBlock: 2023/08/23 13:36:13 countries: [DELETED] INFO: GeoBlock: 2023/08/23 13:36:13 allow local IPs: true INFO: GeoBlock: 2023/08/23 13:36:13 log local requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log allowed requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log api requests: false INFO: GeoBlock: 2023/08/23 13:36:13 API uri: https://get.geojs.io/v1/ip/country/{ip} INFO: GeoBlock: 2023/08/23 13:36:13 API timeout: 150 INFO: GeoBlock: 2023/08/23 13:36:13 cache size: 15 INFO: GeoBlock: 2023/08/23 13:36:13 force monthly update: true INFO: GeoBlock: 2023/08/23 13:36:13 allow unknown countries: false INFO: GeoBlock: 2023/08/23 13:36:13 unknown country api response: nil INFO: GeoBlock: 2023/08/23 13:36:13 blacklist mode: false INFO: GeoBlock: 2023/08/23 13:36:13 add country header: false INFO: GeoBlock: 2023/08/23 13:36:13 countries: [DELETED] INFO: GeoBlock: 2023/08/23 13:36:13 allow local IPs: true INFO: GeoBlock: 2023/08/23 13:36:13 log local requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log allowed requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log api requests: false INFO: GeoBlock: 2023/08/23 13:36:13 API uri: https://get.geojs.io/v1/ip/country/{ip} INFO: GeoBlock: 2023/08/23 13:36:13 API timeout: 150 INFO: GeoBlock: 2023/08/23 13:36:13 cache size: 15 INFO: GeoBlock: 2023/08/23 13:36:13 force monthly update: true INFO: GeoBlock: 2023/08/23 13:36:13 allow unknown countries: false INFO: GeoBlock: 2023/08/23 13:36:13 unknown country api response: nil INFO: GeoBlock: 2023/08/23 13:36:13 blacklist mode: false INFO: GeoBlock: 2023/08/23 13:36:13 add country header: false INFO: GeoBlock: 2023/08/23 13:36:13 countries: [DELETED] INFO: GeoBlock: 2023/08/23 13:36:13 allow local IPs: true INFO: GeoBlock: 2023/08/23 13:36:13 log local requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log allowed requests: false INFO: GeoBlock: 2023/08/23 13:36:13 log api requests: false INFO: GeoBlock: 2023/08/23 13:36:13 API uri: https://get.geojs.io/v1/ip/country/{ip} INFO: GeoBlock: 2023/08/23 13:36:13 API timeout: 150 INFO: GeoBlock: 2023/08/23 13:36:13 cache size: 15 INFO: GeoBlock: 2023/08/23 13:36:13 force monthly update: true INFO: GeoBlock: 2023/08/23 13:36:13 allow unknown countries: false INFO: GeoBlock: 2023/08/23 13:36:13 unknown country api response: nil INFO: GeoBlock: 2023/08/23 13:36:13 blacklist mode: false INFO: GeoBlock: 2023/08/23 13:36:13 add country header: false INFO: GeoBlock: 2023/08/23 13:36:13 countries: [DELETED]

My geoblock settings:

http: middlewares: geoblock: plugin: geoblock: allowLocalRequests: true **logLocalRequests: false logAllowedRequests: false logApiRequests: false** allowUnknownCountries: false forceMonthlyUpdate: "true" unknownCountryApiResponse: nil api: https://get.geojs.io/v1/ip/country/{ip} apiTimeoutMs: 150 cacheSize: 15 countries: ....

Relevant Traefik settings: - --experimental.plugins.geoblock.modulename=github.com/PascalMinder/geoblock - --experimental.plugins.geoblock.version=v0.2.6 - --log.level=warn

Is there a setting I did not turn off in geoblock?

PascalMinder commented 10 months ago

Hi @theAlevan

That's the settings output when the plugin gets started. Currently, it's not possible to suppress it. I look into it. It is possible to add an option to completely disable the output.****

PascalMinder commented 8 months ago

I added the MR #44, which allows disabling the start-up logs.

PascalMinder commented 8 months ago

Solved with https://github.com/PascalMinder/geoblock/releases/tag/v0.2.7