How to get Atlas hostnames using API

Hi team
I am currently trying to automate my log-downloading process from Atlas. I am using Download logs from one cluster in one project Api curl --user ‘{PUBLIC-KEY}:{PRIVATE-KEY}’ --digest \ –header ‘Accept: application/gzip’ \ –request GET “{GROUP-ID}/clusters/{HOSTNAME}/logs/mongodb.gz” \ –output “mongodb.gz” for API.

reference:- How to get Atlas hostnames using CLI and API
As mentioned in the reference above,it is not straight method to get hostname , it gets confusing , mutiple hostname available on the Get Process Endpoint.

how can I get the hostname parameter using API in simple method.

Prabhudeva S

try hitting the api this way:
url = “” + project_id + “/clusters/” + cluster_name + “/logs/” + log_type + “.gz”

I wrote some code in python that grabs some of the data like project id and cluster name and pulls the logs into splunk for us. took me a long time b/c i am not a developer but it works.

Hi, Do you need the log for all clusters or a specific one? Have you tried using Atlas log-push? Doesn’t it get easier?

When did the log push come out? I know that wasn’t around or i wasn’t aware of it last year. nice.

It hasn’t been long, but I think this will help you =D