- Agent : LogBufferService (ring buffer borné, drop-oldest), AgentLoggingProvider
(capture ILogger non-bloquante), LogSanitizer (masque password/token/secret/bearer),
LogUploadService (batch POST /api/agents/{id}/logs, retry, drop si 400)
- Central : entité AgentLogEntry + migration AddAgentLogEntries (index AgentId+TimestampUtc),
SubmitAgentLogsCommand (batch <= 200, entrées invalides ignorées),
GetAgentLogsQuery (pagination, filtres niveau/période/recherche),
endpoints POST + GET /api/agents/{id}/logs
- UI : onglet Logs dans AgentDetail (filtres, pagination, auto-refresh toggle)
- Logs agent enrichis : heartbeat succès (Debug), résolution IP (Debug)
- Tests : LogBufferServiceTests (6), AgentDetailLogsTests (4), handlers AgentLogs (8)
This commit is contained in:
1 parent
ab705e72fa
commit
0136bf33ec
28 files changed
+3261
-3
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using Heimdall.Domain.Entities;
|
||||
using Heimdall.Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Heimdall.Infrastructure.Data.Configurations;
|
||||
|
||||
public class AgentLogEntryConfiguration : IEntityTypeConfiguration<AgentLogEntry>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AgentLogEntry> builder)
|
||||
{
|
||||
builder.ToTable("agent_log_entries");
|
||||
|
||||
builder.HasKey(e => e.Id);
|
||||
|
||||
builder.Property(e => e.TimestampUtc)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(e => e.Level)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(20)
|
||||
.IsRequired()
|
||||
.IsUnicode(false);
|
||||
|
||||
builder.Property(e => e.Message)
|
||||
.HasMaxLength(2000)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(e => e.Exception)
|
||||
.HasMaxLength(4000);
|
||||
|
||||
builder.Property(e => e.Source)
|
||||
.HasMaxLength(200)
|
||||
.IsUnicode(false);
|
||||
|
||||
// Composite index: reads per agent (logs page) + purge by age.
|
||||
builder.HasIndex(e => new { e.AgentId, e.TimestampUtc });
|
||||
|
||||
builder.HasOne(e => e.Agent)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.AgentId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user