Shell script to view logs of a server

Please share a shell script to collect logs of a server (like cpu utilization, memory etc) for a perticular time interval by giving date, time and server name as input.

Collecting SAR data can be done with Sysstat, Atsar, Atop, Dstat or Collectl. Most of these tools (can) run in the background unattended ensuring stats are saved continuously. Where necessary they will contain (separate) tools or switches with which you can extract stats from the (binary) logs based on whatever criteria are available to you, so it kind of depends on the tool you use what and how you'll extract data from it.

Of course you're free to reinvent the wheel again if you "don't like" existing wheels.