Split the logs into two groups: letter-logs and digit-logs. You can tell them apart by checking the first character after the identifier. If it's a digit, it's a digit-log.
For letter-logs, write a custom comparator. Compare by the content portion first (everything after the identifier). If two logs have identical content, break the tie using the identifier.
Digit-logs stay in their original relative order. After sorting the letter-logs, concatenate them with the digit-logs at the end.
The whole approach is a single partition step followed by a stable sort on one group.