The gl2_remote_ip
is being set only if the raw message (received by the network transport) does contain information about the remote address:
Some inputs don’t set this remote address information, so you might be out of luck.
You could also use the debug()
function to check the actual contents of the messages for which the rule is being executed.