You can append
logger.randomname.name = logstash.codec.json
logger.randomname.level = ERROR
to your log4j2.properties file. When I set the target option on a json codec the fields are moved under the target. For example,
input { generator { count => 1 lines => [ '{ "a": 1 }' ] codec => json { target => "[document]" } } }
filter {}
output { stdout { codec => rubydebug { metadata => false } } }
produces
"document" => {
"a" => 1
},