Cybersecurity related: To know the last logon details of the servers

Hi Everyone,

I need a script which fetches the last logon details such as username, time from the remote servers.

Example: When I mention the servername, I need to get the details of the user who has last logged in and the time.
Any command which lists all the servers and the last login details of the user name and time in linux.

Any help to know which servers are actively being used and which are not from past 30 days on linux.

As there are many servers which I would like to check so i need a dynamic script.
Another idea is if I upload an excel which consists of the server names, the script should generate the last logins of the user.

Thank you