How to fix logstash error Unable to retrieve license information from license server

Once you started your logstash server, you could probably get this kind of error:

Unable to retrieve license information from license server 
{:message=>"Elasticsearch Unreachable:[http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch"}
[ERROR][logstash.monitoring.internalpipelinesource] Failed to fetch X-Pack information from Elasticsearch. 
This is likely due to failure to reach a live Elasticsearch cluster.

There is a quick fix, just add

XPACK_MONITORING_ENABLED=false

in your env variables and this error will disappear.