How to get Atlas hostnames using CLI and API

Hi there,
I am currently trying to automate my log-downloading process from Atlas. I am using atlas logs download <hostname> <mongodb.gz|mongos.gz|mongosqld.gz|mongodb-audit-log.gz|mongos-audit-log.gz> [options] for CLI
and curl --user '{PUBLIC-KEY}:{PRIVATE-KEY}' --digest \ --header 'Accept: application/gzip' \ --request GET "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{HOSTNAME}/logs/mongodb.gz" \ --output "mongodb.gz" for API.

My question is how can I get the hostname parameter using API and CLI?

Thanks!

Hi @Jie_Dong,
I’m sorry the experience is sub-optimal here and not as straight forward as we’d like to. The best way to get the hostname is to use Get Processes endpoint or “atlas process list -o json” command in the Atlas CLI. Host name example: atlas-vpjr9d-shard-00-03.hbmflhz.mongodb.net.
Thanks,
Jakub

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.