42 lines
No EOL
1.2 KiB
C#
42 lines
No EOL
1.2 KiB
C#
using MongoDB.Bson;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using MongoDB.Driver;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Insight.Infrastructure.Entities;
|
|
|
|
public static partial class MongoDatabaseExtensions
|
|
{
|
|
public static IMongoCollection<AgentLogEntity> AgentLog(this IMongoDatabase database) => database.GetCollection<AgentLogEntity>("agent_log");
|
|
}
|
|
|
|
[BsonIgnoreExtraElements]
|
|
public class AgentLogEntity
|
|
{
|
|
[BsonId, BsonRepresentation(BsonType.ObjectId), JsonPropertyName("id")]
|
|
public string? Id { get; set; }
|
|
|
|
[BsonElement("_agent"), BsonRepresentation(BsonType.ObjectId), JsonPropertyName("agent")]
|
|
public string? Agent { get; set; }
|
|
|
|
[BsonElement("insert")]
|
|
public DateTime? Insert { get; set; }
|
|
|
|
[BsonElement("eventid")]
|
|
public string? EventId { get; set; }
|
|
|
|
[BsonElement("status")]
|
|
public string? Status { get; set; }
|
|
|
|
[BsonElement("source")]
|
|
public string? Source { get; set; }
|
|
|
|
[BsonElement("category")]
|
|
public string? Category { get; set; }
|
|
|
|
[BsonElement("message")]
|
|
public string? Message { get; set; }
|
|
|
|
[BsonElement("timestamp")]
|
|
public DateTime? Timestamp { get; set; }
|
|
} |