Your task is to implement a function that groups a list of log entries into clusters based on their timestamps. Each log entry is represented as an object with the following structure:
{
"timestamp": "ISO 8601 formatted string (e.g., 2024-11-03T15:30:00Z)",
"message": "A brief log message"
}
The input is an unsorted array of such log entry objects. You must perform the following steps:
- Sort the log entries in chronological order.
- Cluster the sorted entries so that each cluster contains consecutive entries where the difference between any two consecutive log entries is no more than one hour.
- Return an array of clusters (each cluster being an array of log entries sorted in chronological order).
For example, given the following log entries:
- { "timestamp": "2024-11-03T10:00:00Z", "message": "Log A" }
- { "timestamp": "2024-11-03T10:30:00Z", "message": "Log B" }
- { "timestamp": "2024-11-03T12:00:00Z", "message": "Log C" }
- { "timestamp": "2024-11-03T12:45:00Z", "message": "Log D" }
They should form two clusters:
- Cluster 1: [Log A, Log B]
- Cluster 2: [Log C, Log D]
Additional details:
- The timestamps are given in ISO 8601 format. You may use standard libraries available in your programming language to parse and manipulate the dates/times.
- The input array may be empty; in such a case, return an empty array.
- You can assume that all log entries will have valid timestamp strings and messages.
Implement your solution in the programming language of your choice.