Should I send the logs from logstash hosts to data nodes or master nodes?

which node for storing the logs?

Quoting the docs for Logstash's elasticsearch output:

It is important to exclude dedicated master nodes from the hosts list to prevent LS from sending bulk requests to the master nodes. So this parameter should only reference either data or client nodes in Elasticsearch.