In case of Graylog see Logging to graylog.
Regarding log4j2 you are limited to the appenders bundeled by ESH.