TestimoX

API Reference

Class

DnsLog

Namespace ADPlayground
Assembly ADPlayground

Provides parsing utilities and log stream helpers for DNS debug logs.

Inheritance

  • Object
  • DnsLog

Constructors

public DnsLog(Int32 maxRawQueries = 1000) #

Initializes a new instance of the DnsLog class.

Parameters

maxRawQueries System.Int32 = 1000 optionalposition: 0

Methods

public Dictionary<String, DnsLogIpSummary> BuildIpSummary(IEnumerable<DnsDebugMessage> entries, DnsLogFilter filter = null, Nullable<Int32> subnetMask = null) #
Returns: Dictionary<String, DnsLogIpSummary>

Builds a summary of DNS queries by IP address from an entry stream.

Parameters

entries System.Collections.Generic.IEnumerable{ADPlayground.DnsDebugMessage} requiredposition: 0
Stream of parsed DNS debug entries.
filter ADPlayground.DnsLogFilter = null optionalposition: 1
Optional filter for entries.
subnetMask System.Nullable{System.Int32} = null optionalposition: 2
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) #
Returns: 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} requiredposition: 0
Stream of parsed DNS debug entries.
searchZones System.String[] requiredposition: 1
Zones to match; others are considered external.
filter ADPlayground.DnsLogFilter = null optionalposition: 2
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 required
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 required
public Dictionary<String, DnsLogIpSummary> GetIpSummary(String filePath, DnsLogFilter filter = null, Nullable<Int32> subnetMask = null) #
Returns: Dictionary<String, DnsLogIpSummary>

Gets a summary of DNS queries by IP address.

Parameters

filePath System.String requiredposition: 0
Path to the DNS debug log.
filter ADPlayground.DnsLogFilter = null optionalposition: 1
Optional filter for entries.
subnetMask System.Nullable{System.Int32} = null optionalposition: 2
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) #
Returns: Task<Dictionary<String, DnsLogIpSummary>>

Asynchronously gets a summary of DNS queries by IP address.

Parameters

filePath System.String requiredposition: 0
filter ADPlayground.DnsLogFilter = null optionalposition: 1
subnetMask System.Nullable{System.Int32} = null optionalposition: 2
public DnsLogSummary GetLogSummary(String filePath) #
Returns: DnsLogSummary

Gets a summary of the DNS debug log file.

Parameters

filePath System.String requiredposition: 0
public Task<DnsLogSummary> GetLogSummaryAsync(String filePath) #
Returns: Task<DnsLogSummary>

Asynchronously gets a summary of the DNS debug log file.

Parameters

filePath System.String requiredposition: 0
GetProgressUpdateInterval(System.Int64 totalBytes, System.Nullable{System.Int64} interval) #

Calculates the interval at which progress updates are reported.

Parameters

totalBytes System.Int64 required
Total size of the file being processed.
interval System.Nullable{System.Int64} required
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) #
Returns: ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>>

Gets a summary of DNS queries by zone.

Parameters

filePath System.String requiredposition: 0
searchZones System.String[] requiredposition: 1
filter ADPlayground.DnsLogFilter = null optionalposition: 2
public async Task<ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>>> GetZoneSummaryAsync(String filePath, String[] searchZones, DnsLogFilter filter = null) #
Returns: Task<ValueTuple<Dictionary<String, DnsLogZoneSummary>, Dictionary<String, DnsLogZoneSummary>>>

Asynchronously gets a summary of DNS queries by zone.

Parameters

filePath System.String requiredposition: 0
searchZones System.String[] requiredposition: 1
filter ADPlayground.DnsLogFilter = null optionalposition: 2
public Boolean MatchesFilter(DnsDebugMessage entry, DnsLogFilter filter) #
Returns: Boolean

Provides a way to filter DNS debug log entries.

Parameters

entry ADPlayground.DnsDebugMessage requiredposition: 0
filter ADPlayground.DnsLogFilter requiredposition: 1
public IEnumerable<DnsDebugMessage> ReadDnsDebugLog(String filePath, Nullable<Int64> progressUpdateInterval = null) #
Returns: IEnumerable<DnsDebugMessage>

Reads DNS debug log entries from the specified file path.

Parameters

filePath System.String requiredposition: 0
progressUpdateInterval System.Nullable{System.Int64} = null optionalposition: 1
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) #
Returns: IAsyncEnumerable<DnsDebugMessage>

Reads DNS debug log entries from the specified file path asynchronously.

Parameters

filePath System.String requiredposition: 0
Path to DNS debug log file.
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Token to observe for cancellation.
cancellationCheckInterval System.Int32 = 32 optionalposition: 2
Number of lines to process between cancellation checks.
progressUpdateInterval System.Nullable{System.Int64} = null optionalposition: 3
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) #
Returns: IEnumerable<DnsDebugMessage>

Reads DNS debug log entries from multiple files.

Parameters

filePaths System.Collections.Generic.IEnumerable{System.String} requiredposition: 0
Collection of DNS debug log file paths.
continueOnError System.Boolean = false optionalposition: 1
When true, skips files that fail to read.
runInParallel System.Boolean = false optionalposition: 2
When true, processes files concurrently without preserving order.
progress System.IProgress{ADPlayground.DnsLogBatchProgress} = null optionalposition: 3
Optional batch progress reporter.
progressUpdateInterval System.Nullable{System.Int64} = null optionalposition: 4
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 optionalposition: 5
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 optionalposition: 6
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) #
Returns: IAsyncEnumerable<DnsDebugMessage>

Asynchronously reads DNS debug log entries from multiple files.

Parameters

filePaths System.Collections.Generic.IEnumerable{System.String} requiredposition: 0
Collection of DNS debug log file paths.
continueOnError System.Boolean = false optionalposition: 1
When true, skips files that fail to read.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Token to observe for cancellation.
cancellationCheckInterval System.Int32 = 32 optionalposition: 3
Number of lines to process between cancellation checks.
runInParallel System.Boolean = false optionalposition: 4
When true, processes files concurrently without preserving order.
progress System.IProgress{ADPlayground.DnsLogBatchProgress} = null optionalposition: 5
Optional batch progress reporter.
progressUpdateInterval System.Nullable{System.Int64} = null optionalposition: 6
Minimum bytes between progress updates for individual files. Defaults to 1% of file size or 1 MB, whichever is larger.
options ADPlayground.DnsLogProcessingOptions = null optionalposition: 7
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) #
Returns: IEnumerable<DnsDebugMessage>

Watches the specified DNS log file for new entries synchronously.

Parameters

filePath System.String requiredposition: 0
Path to the DNS debug log.
checkpointPath System.String = null optionalposition: 1
Optional path to a checkpoint file.
retentionDays System.Int32 = 0 optionalposition: 2
Retention window for raw entries in days.
fromBeginning System.Boolean = false optionalposition: 3
If true, reads existing entries when no checkpoint is found.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Cancellation token to stop watching.
alertCallback System.Action{System.String} = null optionalposition: 5
Optional callback invoked when thresholds are exceeded.
ipThreshold System.Int32 = 0 optionalposition: 6
Unique IP threshold for alerts.
zoneThreshold System.Int32 = 0 optionalposition: 7
Zone threshold for alerts.
window System.Nullable{System.TimeSpan} = null optionalposition: 8
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) #
Returns: IAsyncEnumerable<DnsDebugMessage>

Watches the specified DNS log file for new entries.

Parameters

filePath System.String requiredposition: 0
Path to the DNS debug log.
checkpointPath System.String = null optionalposition: 1
Optional path to a checkpoint file.
retentionDays System.Int32 = 0 optionalposition: 2
Retention window for raw entries in days.
fromBeginning System.Boolean = false optionalposition: 3
If true, reads existing entries when no checkpoint is found.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Cancellation token to stop watching.
alertCallback System.Action{System.String} = null optionalposition: 5
Optional callback invoked when thresholds are exceeded.
ipThreshold System.Int32 = 0 optionalposition: 6
Unique IP threshold for alerts.
zoneThreshold System.Int32 = 0 optionalposition: 7
Zone threshold for alerts.
window System.Nullable{System.TimeSpan} = null optionalposition: 8
Time window for alert calculations.

Returns

Asynchronous stream of log entries.

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.

Fields

MaxUnknownRecordTypes #

Maximum number of unknown DNS record types to retain.

SmallFileThreshold #

Files smaller than this threshold (100 MB) are read entirely into memory.

LargeFileThreshold #

Files at or above this threshold (1 GB) use memory-mapped access.