Skip to content

Commit 5a3c34b

Browse files
committed
tweak key generator
1 parent 905fee0 commit 5a3c34b

File tree

2 files changed

+3
-525
lines changed

2 files changed

+3
-525
lines changed

src/Serilog.Sinks.AzureTableStorage/Sinks/AzureTableStorage/DefaultKeyGenerator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public virtual string GeneratePartitionKey(LogEvent logEvent)
2424
}
2525

2626
/// <summary>
27-
/// Automatically generates the RowKey using the timestamp
27+
/// Automatically generates the RowKey using the timestamp
2828
/// </summary>
2929
/// <param name="logEvent">the log event</param>
3030
/// <returns>The generated RowKey</returns>
3131
public virtual string GenerateRowKey(LogEvent logEvent)
3232
{
3333
var utcEventTime = logEvent.Timestamp.UtcDateTime;
3434

35-
// use time based object id to create key
36-
return ObjectId.GenerateNewId(utcEventTime).ToString();
35+
// create a 19 character String for reverse chronological ordering.
36+
return $"{DateTime.MaxValue.Ticks - utcEventTime.Ticks:D19}";
3737
}
3838

3939

0 commit comments

Comments
 (0)