I have this error bash: ./metricbeat: cannot execute binary file: Exec format error

Does the log path Exist and is it writeable? It looks like it is not you need to fix that.

ls -l /var/log

path.logs: /var/log/elasticsearch

please check them

ls -l  /var/log
ls -l  /var/log/elasticsearch

The last line says...

what happens when you try

curl localhost:9200