diff --git a/src/SeqCli/Cli/Commands/Forwarder/TruncateCommand.cs b/src/SeqCli/Cli/Commands/Forwarder/TruncateCommand.cs index bf50a2ae..2ee8e01e 100644 --- a/src/SeqCli/Cli/Commands/Forwarder/TruncateCommand.cs +++ b/src/SeqCli/Cli/Commands/Forwarder/TruncateCommand.cs @@ -13,6 +13,7 @@ // limitations under the License. using System; +using System.IO; using System.Threading.Tasks; using SeqCli.Cli.Features; using Serilog; @@ -37,7 +38,11 @@ protected override async Task Run(string[] args) { if (!_confirm.TryConfirm("All data in the forwarder's log buffer will be deleted. This cannot be undone.")) return 1; - + + foreach (var bufferStorageDirectory in Directory.GetDirectories(_storagePath.BufferPath)) + { + Directory.Delete(bufferStorageDirectory, true); + } return 0; } catch (Exception ex) diff --git a/src/SeqCli/Forwarder/Channel/ForwardingChannelMap.cs b/src/SeqCli/Forwarder/Channel/ForwardingChannelMap.cs index 100ca72e..08132ceb 100644 --- a/src/SeqCli/Forwarder/Channel/ForwardingChannelMap.cs +++ b/src/SeqCli/Forwarder/Channel/ForwardingChannelMap.cs @@ -34,13 +34,13 @@ ForwardingChannel OpenOrCreateChannel(string? apiKey, string name) // TODO, when it's not the default, persist the API key and validate equality on reopen var storePath = Path.Combine(_bufferPath, name); - var defaultStore = new SystemStoreDirectory(storePath); + var store = new SystemStoreDirectory(storePath); Log.Information("Opening local buffer in {StorePath}", storePath); return new ForwardingChannel( - BufferAppender.Open(defaultStore), - BufferReader.Open(defaultStore), - Bookmark.Open(defaultStore), + BufferAppender.Open(store), + BufferReader.Open(store), + Bookmark.Open(store), _connection, apiKey, _shutdownTokenSource.Token); diff --git a/src/SeqCli/Forwarder/Storage/BufferAppender.cs b/src/SeqCli/Forwarder/Storage/BufferAppender.cs index bc2ca6a6..fc5c501a 100644 --- a/src/SeqCli/Forwarder/Storage/BufferAppender.cs +++ b/src/SeqCli/Forwarder/Storage/BufferAppender.cs @@ -45,7 +45,7 @@ public static BufferAppender Open(StoreDirectory storeDirectory) } /// - /// Try write a batch. + /// Try to write a batch. /// /// This method does not throw. ///