API Reference
DnsLog
Provides parsing utilities and log stream helpers for DNS debug logs.
Inheritance
- Object
- DnsLog
Constructors
Methods
public Dictionary<String, DnsLogIpSummary> BuildIpSummary(IEnumerable<DnsDebugMessage> entries, DnsLogFilter filter = null, Nullable<Int32> subnetMask = null) #Dictionary<String, DnsLogIpSummary>Builds a summary of DNS queries by IP address from an entry stream.
Parameters
- entries System.Collections.Generic.IEnumerable{ADPlayground.DnsDebugMessage}
- Stream of parsed DNS debug entries.
- filter ADPlayground.DnsLogFilter = null
- Optional filter for entries.
- subnetMask System.Nullable{System.Int32} = null
- CIDR prefix length for grouping results.
Returns
Summary grouped by IP address.
public ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>> BuildZoneSummary(IEnumerable<DnsDebugMessage> entries, String[] searchZones, DnsLogFilter filter = null) #ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>>Builds a summary of DNS queries by zone from an entry stream.
Parameters
- entries System.Collections.Generic.IEnumerable{ADPlayground.DnsDebugMessage}
- Stream of parsed DNS debug entries.
- searchZones System.String[]
- Zones to match; others are considered external.
- filter ADPlayground.DnsLogFilter = null
- Optional filter for entries.
Returns
Matched and unmatched zone summaries.
CreateLogStream(System.String arg1) #Creates a stream for reading a DNS debug log file synchronously.
Parameters
- arg1 System.String
CreateLogStreamAsync(System.String arg1) #Creates a stream for reading a DNS debug log file asynchronously. Files smaller than SmallFileThreshold are read into memory for faster access, trading reduced I/O for an allocation roughly equal to the file size. UNC paths are streamed to avoid copying the entire file into memory.
Parameters
- arg1 System.String
public Dictionary<String, DnsLogIpSummary> GetIpSummary(String filePath, DnsLogFilter filter = null, Nullable<Int32> subnetMask = null) #Dictionary<String, DnsLogIpSummary>Gets a summary of DNS queries by IP address.
Parameters
- filePath System.String
- Path to the DNS debug log.
- filter ADPlayground.DnsLogFilter = null
- Optional filter for entries.
- subnetMask System.Nullable{System.Int32} = null
- CIDR prefix length for grouping results.
Returns
Summary grouped by IP address.
public async Task<Dictionary<String, DnsLogIpSummary>> GetIpSummaryAsync(String filePath, DnsLogFilter filter = null, Nullable<Int32> subnetMask = null) #Task<Dictionary<String, DnsLogIpSummary>>Asynchronously gets a summary of DNS queries by IP address.
Parameters
- filePath System.String
- filter ADPlayground.DnsLogFilter = null
- subnetMask System.Nullable{System.Int32} = null
public DnsLogSummary GetLogSummary(String filePath) #DnsLogSummaryGets a summary of the DNS debug log file.
Parameters
- filePath System.String
public Task<DnsLogSummary> GetLogSummaryAsync(String filePath) #Task<DnsLogSummary>Asynchronously gets a summary of the DNS debug log file.
Parameters
- filePath System.String
GetProgressUpdateInterval(System.Int64 totalBytes, System.Nullable{System.Int64} interval) #Calculates the interval at which progress updates are reported.
Parameters
- totalBytes System.Int64
- Total size of the file being processed.
- interval System.Nullable{System.Int64}
- Optional custom interval in bytes. Must be positive and no greater than totalBytes. If not specified, defaults to 1% of the total file size or 1 MB, whichever is larger.
Returns
The effective progress update interval in bytes.
Exceptions
ArgumentOutOfRangeException– Thrown when totalBytes is not positive or when interval is specified but is non-positive or exceeds totalBytes.
public ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>> GetZoneSummary(String filePath, String[] searchZones, DnsLogFilter filter = null) #ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>>Gets a summary of DNS queries by zone.
Parameters
- filePath System.String
- searchZones System.String[]
- filter ADPlayground.DnsLogFilter = null
public async Task<ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>>> GetZoneSummaryAsync(String filePath, String[] searchZones, DnsLogFilter filter = null) #Task<ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>>>Asynchronously gets a summary of DNS queries by zone.
Parameters
- filePath System.String
- searchZones System.String[]
- filter ADPlayground.DnsLogFilter = null
public Boolean MatchesFilter(DnsDebugMessage entry, DnsLogFilter filter) #BooleanProvides a way to filter DNS debug log entries.
Parameters
- entry ADPlayground.DnsDebugMessage
- filter ADPlayground.DnsLogFilter
public IEnumerable<DnsDebugMessage> ReadDnsDebugLog(String filePath, Nullable<Int64> progressUpdateInterval = null) #IEnumerable<DnsDebugMessage>Reads DNS debug log entries from the specified file path.
Parameters
- filePath System.String
- progressUpdateInterval System.Nullable{System.Int64} = null
- Minimum number of bytes between progress updates. Defaults to 1% of total file size or 1 MB, whichever is larger. Smaller values increase update frequency and may impact performance; larger values delay progress reporting.
public IAsyncEnumerable<DnsDebugMessage> ReadDnsDebugLogAsync(String filePath, CancellationToken cancellationToken = null, Int32 cancellationCheckInterval = 32, Nullable<Int64> progressUpdateInterval = null) #IAsyncEnumerable<DnsDebugMessage>Reads DNS debug log entries from the specified file path asynchronously.
Parameters
- filePath System.String
- Path to DNS debug log file.
- cancellationToken System.Threading.CancellationToken = null
- Token to observe for cancellation.
- cancellationCheckInterval System.Int32 = 32
- Number of lines to process between cancellation checks.
- progressUpdateInterval System.Nullable{System.Int64} = null
- Minimum number of bytes between progress updates. Defaults to 1% of total file size or 1 MB, whichever is larger. Smaller values increase update frequency and may impact performance; larger values delay progress reporting.
Returns
Asynchronous stream of DnsDebugMessage.
public IEnumerable<DnsDebugMessage> ReadDnsDebugLogs(IEnumerable<String> filePaths, Boolean continueOnError = false, Boolean runInParallel = false, IProgress<DnsLogBatchProgress> progress = null, Nullable<Int64> progressUpdateInterval = null, Nullable<TimeSpan> perFileTimeout = null, DnsLogProcessingOptions options = null) #IEnumerable<DnsDebugMessage>Reads DNS debug log entries from multiple files.
Parameters
- filePaths System.Collections.Generic.IEnumerable{System.String}
- Collection of DNS debug log file paths.
- continueOnError System.Boolean = false
- When true, skips files that fail to read.
- runInParallel System.Boolean = false
- When true, processes files concurrently without preserving order.
- progress System.IProgress{ADPlayground.DnsLogBatchProgress} = null
- Optional batch progress reporter.
- progressUpdateInterval System.Nullable{System.Int64} = null
- Minimum bytes between progress updates for individual files. Defaults to 1% of file size or 1 MB, whichever is larger.
- perFileTimeout System.Nullable{System.TimeSpan} = null
- Optional timeout for each individual file when processing in parallel. Files that exceed this timeout are cancelled and their tasks complete immediately. If continueOnError is true, other files continue processing; if false, the entire operation throws OperationCanceledException.
- options ADPlayground.DnsLogProcessingOptions = null
- Optional processing behavior such as caching UNC paths.
Returns
Sequence of DnsDebugMessage spanning all files.
public IAsyncEnumerable<DnsDebugMessage> ReadDnsDebugLogsAsync(IEnumerable<String> filePaths, Boolean continueOnError = false, CancellationToken cancellationToken = null, Int32 cancellationCheckInterval = 32, Boolean runInParallel = false, IProgress<DnsLogBatchProgress> progress = null, Nullable<Int64> progressUpdateInterval = null, DnsLogProcessingOptions options = null) #IAsyncEnumerable<DnsDebugMessage>Asynchronously reads DNS debug log entries from multiple files.
Parameters
- filePaths System.Collections.Generic.IEnumerable{System.String}
- Collection of DNS debug log file paths.
- continueOnError System.Boolean = false
- When true, skips files that fail to read.
- cancellationToken System.Threading.CancellationToken = null
- Token to observe for cancellation.
- cancellationCheckInterval System.Int32 = 32
- Number of lines to process between cancellation checks.
- runInParallel System.Boolean = false
- When true, processes files concurrently without preserving order.
- progress System.IProgress{ADPlayground.DnsLogBatchProgress} = null
- Optional batch progress reporter.
- progressUpdateInterval System.Nullable{System.Int64} = null
- Minimum bytes between progress updates for individual files. Defaults to 1% of file size or 1 MB, whichever is larger.
- options ADPlayground.DnsLogProcessingOptions = null
- Optional processing behavior such as caching UNC paths.
Returns
Asynchronous sequence of DnsDebugMessage spanning all files.
public IEnumerable<DnsDebugMessage> WatchDnsDebugLog(String filePath, String checkpointPath = null, Int32 retentionDays = 0, Boolean fromBeginning = false, CancellationToken cancellationToken = null, Action<String> alertCallback = null, Int32 ipThreshold = 0, Int32 zoneThreshold = 0, Nullable<TimeSpan> window = null) #IEnumerable<DnsDebugMessage>Watches the specified DNS log file for new entries synchronously.
Parameters
- filePath System.String
- Path to the DNS debug log.
- checkpointPath System.String = null
- Optional path to a checkpoint file.
- retentionDays System.Int32 = 0
- Retention window for raw entries in days.
- fromBeginning System.Boolean = false
- If true, reads existing entries when no checkpoint is found.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token to stop watching.
- alertCallback System.Action{System.String} = null
- Optional callback invoked when thresholds are exceeded.
- ipThreshold System.Int32 = 0
- Unique IP threshold for alerts.
- zoneThreshold System.Int32 = 0
- Zone threshold for alerts.
- window System.Nullable{System.TimeSpan} = null
- Time window for alert calculations.
Returns
Enumerable of log entries.
public IAsyncEnumerable<DnsDebugMessage> WatchDnsDebugLogAsync(String filePath, String checkpointPath = null, Int32 retentionDays = 0, Boolean fromBeginning = false, CancellationToken cancellationToken = null, Action<String> alertCallback = null, Int32 ipThreshold = 0, Int32 zoneThreshold = 0, Nullable<TimeSpan> window = null) #IAsyncEnumerable<DnsDebugMessage>Watches the specified DNS log file for new entries.
Parameters
- filePath System.String
- Path to the DNS debug log.
- checkpointPath System.String = null
- Optional path to a checkpoint file.
- retentionDays System.Int32 = 0
- Retention window for raw entries in days.
- fromBeginning System.Boolean = false
- If true, reads existing entries when no checkpoint is found.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token to stop watching.
- alertCallback System.Action{System.String} = null
- Optional callback invoked when thresholds are exceeded.
- ipThreshold System.Int32 = 0
- Unique IP threshold for alerts.
- zoneThreshold System.Int32 = 0
- Zone threshold for alerts.
- window System.Nullable{System.TimeSpan} = null
- Time window for alert calculations.
Returns
Asynchronous stream of log entries.
Inherited Methods
Properties
public Int32 MaxRawQueries { get; set; } #Gets or sets the maximum number of raw queries to retain per summary. Use 0 to disable raw query storage.
public Action<Int64> Progress { get; set; } #Gets or sets a progress reporter for bytes read.
public IReadOnlyCollection<String> UnknownRecordTypes { get; } #Gets the collection of unknown DNS record types encountered during parsing.
public IReadOnlyCollection<DnsDebugMessage> RecentEntries { get; } #Gets the collection of recent entries kept for retention.
RotationTestHook #Internal test hook to force rotation handling.