Hi Mauro,
The field GeoLocation.country_name is enriched by Wazuh-Indexer based on some alert's IP fields. This step takes place at a higher level of the stack than when the events are matched to the rules. That is why you can see the field in the final event but it is not considered to trigger the alert. That field is not available during the alert processing. The important thing to understand here is that by default the geolocation information is not available at the moment that the event is being analyzed for rule matching. That is why your rule will not work.
To workaround this you can compile the Wazuh Server enabling the USE_GEOIP flag
In order to create rules that can use geolocation, you must build Wazuh with the flag USE_GEOIP=yes.
It also requires a GeoIP database: We support the legacy Maxmind GeoLite format, and the updated and maintained databases use the new GeoLite2 format. It should be converted to the legacy format using an external tool.
Let me know if you need any further information.
As you have already configured geoip
geoipcountry is a dynamic field.
You can make use of <different_field>field_name</different_field> for dynamic value.
Check the document for reference:
https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/rules.html#same-field