You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGES.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,12 @@
1
1
# Changes
2
2
3
+
### 4.0.0 07/17/2024
4
+
- Updated to Serilog 4.0.0 and implemented support for Serilog native IBatchedLogEventSink. All usage of AzureBlobStorage is now batched on a default 2 second emit interval. The first log event is written immediately.
5
+
- Implemented support for including the log event level (Information, Warning, etc) in the file name template. This is done by including the `Level` property in the template. For example, `Log-{yyyy}-{MM}-{dd}-{Level}.txt` will create files like `Log-2024-07-17-Information.txt`.
6
+
- Fixed support for deleting old files by implementing Regex matching instead of DateTime parsing in the delete routine.
7
+
- Added console app sample to demonstrate the new features.
8
+
- This major update may require you to alter your configuration settings where you define usage of this sink.
9
+
3
10
### 3.3.2 07/13/2024
4
11
- Updated Azure.Identity to fix CVE-2024-35255. The next release will be a major version update to adopt Serilog 4.0.0 and IBatchedLogEventSink.
@@ -98,6 +98,13 @@ As of version 2.0.0, the values are not required to appear in descending order,
98
98
2019/06/20/2019-06-20_14:40.txt
99
99
```
100
100
101
+
#### Other substitutions in the file name.
102
+
103
+
- You can add the LogEventLevel to the file name by using the {Level} descriptor. For example, use this file name template: {Level}.txt.
104
+
- If you push properties into Serilog, you can use those within your file name template. Caution! If you do this, you must do it consistently. For more information, see the 'Multi-tenant support' example below.
105
+
106
+
All of these substitutions can be used in together and also with the date formats.
107
+
101
108
#### Maximum file size
102
109
103
110
You can limit the size of each file created as of version 2.0.0. There is a constructor parameter called `blobSizeLimitBytes`. By
@@ -110,20 +117,20 @@ be deleted every time a new file is created in order to stay within this limit.
110
117
111
118
#### Batch posting example
112
119
113
-
By default, whenever there is a new event to post, the Azure Blob Storage sink will send it to Azure storage. For cost-management or performance reasons, you can
114
-
choose to "batch" the posting of new log events.
120
+
As of version 4.0, the AzureBlobStorageSink uses batching exclusively for posting events, and uses Serilog 4.0's native batching features. There is no configuration
121
+
required to take advantage of this feature. Batches are emitted every 2 seconds, if events are waiting. A single batch can include up to 1000 events.
115
122
116
-
You should create the sink by calling the [AzureBatchingBlobStorageSink](https://github.com/chriswill/serilog-sinks-azureblobstorage/blob/master/src/Serilog.Sinks.AzureBlobStorage/Sinks/AzureBlobStorage/AzureBatchingBlobStorageSink.cs) class, which inherits from PeriodicBatchingSink.
123
+
If you want to control the batch posting limit and the period, you can do so by using the `batchPostingLimit` and `period` parameters.
This configuration would post a new batch of events every 15 seconds, unless there were 10 or more events to post, in which case they would post before the time limit.
131
+
This configuration would post a new batch of events every 30 seconds, unless there were 50 or more events to post, in which case they would post before the time limit.
125
132
126
-
To specify batch posting using configuration, configure use need to set these mandatory values:
133
+
To specify batch posting using appsettings configuration, configure these values:
127
134
128
135
```json
129
136
"WriteTo": [
@@ -133,9 +140,8 @@ To specify batch posting using configuration, configure use need to set these ma
133
140
"connectionString": "",
134
141
"storageContainerName": "",
135
142
"storageFileName": "",
136
-
"writeInBatches": "true", // mandatory
137
-
"period": "0.00:00:30", // mandatory sets the period to 30 secs
138
-
"batchPostingLimit": "50", // optional
143
+
"period": "00:00:30", // optional sets the period to 30 secs
144
+
"batchPostingLimit": "50", // optional, sets the max batch limit to 50
139
145
}
140
146
}
141
147
]
@@ -149,8 +155,8 @@ To configure, create a storage filename that includes a tenant id property.
0 commit comments