<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244409#M27701</link>
    <description>&lt;P&gt;Splunk Stream can do this work, we are using the stream forwarder on the non-windows platform and it's great for DNS traffic.&lt;/P&gt;

&lt;P&gt;We are evaluating it's usage for windows as the documentation mentions that winpcap allows any local user to use it (not a Splunk issue but the Splunk Stream uses that library on Windows).&lt;/P&gt;</description>
    <pubDate>Sat, 21 Jan 2017 03:58:24 GMT</pubDate>
    <dc:creator>gjanders</dc:creator>
    <dc:date>2017-01-21T03:58:24Z</dc:date>
    <item>
      <title>Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244405#M27697</link>
      <description>&lt;P&gt;I've deployed the Windows DNS Analytical and Diagnostic Logs add-on to our DNS servers, but the PowerShell script returns the following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ERROR ExecProcessor - message from "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "&amp;amp; 'C:\Program Files\SplunkUniversalForwarder\etc\apps\TA-windnsanalytical\bin\get_dns_analytics.ps1'"" Get-WinEvent : The requested operation cannot be performed over an enabled direct channel. The channel must first be disabled before performing the requested operation.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I suppose this is normal with ETL logs. The fix appears to be to let the log fill up and clear it manually, or let it roll off into archived files, which will eventually need to be deleted manually. This doesn't help the fact that Splunk still wouldn't be able to monitor the active ETL analytics log while it's being written to. &lt;/P&gt;

&lt;P&gt;So I guess my option is to roll the log into archive files, and monitor the archive files (a batch input maybe)? How is everyone else monitoring the Analytics log? We really don't want to enable debug logging on our DNS servers due to the performance hit. It seems like this add-on can only work if the retention on the DNS Analytics log is configured to "Do not automatically overwrite events". &lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2017 21:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244405#M27697</guid>
      <dc:creator>coltwanger</dc:creator>
      <dc:date>2017-01-19T21:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244406#M27698</link>
      <description>&lt;P&gt;Splunk Stream can do this work, we are using the stream forwarder on the non-windows platform and it's great for DNS traffic. &lt;/P&gt;

&lt;P&gt;We are evaluating it's usage for windows as the documentation mentions that winpcap allows any local user to use it (not a Splunk issue but the Splunk Stream uses that library on Windows).&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 07:50:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244406#M27698</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-01-20T07:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244407#M27699</link>
      <description>&lt;P&gt;I have never even considered this option -- thanks for bringing it up, I'll be looking into it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 17:54:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244407#M27699</guid>
      <dc:creator>coltwanger</dc:creator>
      <dc:date>2017-01-20T17:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244408#M27700</link>
      <description>&lt;P&gt;I've moved my comment into the answers section as it is effectively a possible answer...&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 03:58:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244408#M27700</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-01-21T03:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244409#M27701</link>
      <description>&lt;P&gt;Splunk Stream can do this work, we are using the stream forwarder on the non-windows platform and it's great for DNS traffic.&lt;/P&gt;

&lt;P&gt;We are evaluating it's usage for windows as the documentation mentions that winpcap allows any local user to use it (not a Splunk issue but the Splunk Stream uses that library on Windows).&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 03:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244409#M27701</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-01-21T03:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244410#M27702</link>
      <description>&lt;P&gt;Stream worked beautifully -- thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 01:00:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244410#M27702</guid>
      <dc:creator>coltwanger</dc:creator>
      <dc:date>2017-01-27T01:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244411#M27703</link>
      <description>&lt;P&gt;Glad I was able to help! Have a good day.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 01:10:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244411#M27703</guid>
      <dc:creator>gjanders</dc:creator>
      <dc:date>2017-01-27T01:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244412#M27704</link>
      <description>&lt;P&gt;We've tried using Splunk Stream for DNS logging (on DNS servers and domain controllers) but it appears the traffic volume is too great (~10k queries per second), and the universal forwarder appears to bottleneck the Streamfwd process, even with maxKBps=0 in the limits.conf file. Has anyone had such issues with Stream? I realize in cases when DNS is run on Linux, you can deploy the standalone Stream Forward binary so there's no potential limiting from a UF, but they don't support a separate install for Windows as of now. Curious if anyone has any details/thoughts.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 19:00:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244412#M27704</guid>
      <dc:creator>gawilliams</dc:creator>
      <dc:date>2017-03-24T19:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244413#M27705</link>
      <description>&lt;P&gt;Have you tried aggregation to see if you can reduce the amount of events being forwarded?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/StreamApp/7.0.1/User/StreamAggregationMethods"&gt;https://docs.splunk.com/Documentation/StreamApp/7.0.1/User/StreamAggregationMethods&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 19:16:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244413#M27705</guid>
      <dc:creator>coltwanger</dc:creator>
      <dc:date>2017-03-24T19:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244414#M27706</link>
      <description>&lt;P&gt;I haven't tested fully but I think this code will avoid the "requested operation cannot be performed over an enabled direct channel" issue.   I would replace the code in get_dns_analytics.ps1 with this.&lt;/P&gt;

&lt;P&gt;Adapted from &lt;A href="https://social.technet.microsoft.com/Forums/ie/en-US/6798f4ab-1443-4bdb-9ba5-5fe9c1f9d7bb/can-you-forward-analytic-and-debug-log?forum=winserver8gen" target="_blank"&gt;a Technet post&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$logName = 'Microsoft-Windows-DNSServer/Analytical'

$eventlogSettings = get-winevent -ListLog $logName
$logFileRoot = Split-Path $eventlogSettings.LogFilePath -Parent
$logFileA = [System.Environment]::ExpandEnvironmentVariables($eventlogSettings.LogFilePath)  # need to expand variables for later use by Get-WinEvent
$logFileB = "{0}\Microsoft-Windows-DNSServer%4Analytical.{1:yyyyMMddhhmmss}.etl" -f $logFileRoot,(Get-Date).ToUniversalTime()
$filterXPath = "*[System[EventID!=280] and EventData[Data[@Name='InterfaceIP']!='127.0.0.1']]"

# Rotate the log file
Write-Host "rotating out " $eventlogSettings.LogFilePath

Set-Service DNS -Status Paused
$eventlogSettings.IsEnabled = $false
$eventlogSettings.LogFilePath = $logFileB
$eventlogSettings.SaveChanges()

$eventlogSettings.IsEnabled = $true
$eventlogSettings.SaveChanges()
Set-Service DNS -Status Running

# Read events to STDOUT
Get-WinEvent -Oldest -Path $logFileA -FilterXPath $filterXPath | fl

# TODO delete $logFileA
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:03:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244414#M27706</guid>
      <dc:creator>hughkelley</dc:creator>
      <dc:date>2020-09-29T19:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244415#M27707</link>
      <description>&lt;P&gt;So here is how i do it:&lt;BR /&gt;
first of all i have configured the log for rotation, although you can not actively see the logs in the event viewer but it is perfectly fine and it is still collecting logs.&lt;BR /&gt;
i have a powershell script that goes over the log "scheduled to run every 5 minutes" and dump/append the logs for the past 5 minute to a CSV file. I am only looking for event ID 257 and 256 i also have a regex built into the script that will discard the "packet data" which is part of the event message. this will help dramatically controlling the amount of data fed into splunk.&lt;BR /&gt;
the rest is easy, create an index and feed the CSV to Splunk!!&lt;BR /&gt;
here is the powershell script i am using :&lt;BR /&gt;
i am not sure why but when adding the code here; all "$_" are replaced with "$"  just remember to replace them back. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt; &lt;BR /&gt;
$SC_start=Get-Date&lt;BR /&gt;
$CSV_fileName="C:\dnsanalytics\DNSANALYTICALS-"+(Get-Date).ToString("yyyy-MM-dd")+".csv"&lt;BR /&gt;
$test=get-winevent -Oldest -Path C:\Windows\System32\winevt\Logs\Microsoft-Windows-DNSServer%4Analytical.etl|Where-Object{$&lt;EM&gt;.ID -eq "257" -or  $&lt;/EM&gt;.ID -eq "256" -and $&lt;EM&gt;.TimeCreated -ge $SC_start.AddMinutes(-5)}|Select-Object @{Label = "Date";Expression = {$&lt;/EM&gt;.TimeCreated}},&lt;BR /&gt;
@{Label = "ID";Expression = {$&lt;EM&gt;.id}},&lt;BR /&gt;
@{Label = "Message";Expression = {$&lt;/EM&gt;.Message -replace ('((?&amp;lt;=;\s)(?=\bPacketData\b))[^"]+')}}|Export-Csv -append -Path $CSV_fileName -NoType&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244415#M27707</guid>
      <dc:creator>mpasha</dc:creator>
      <dc:date>2020-09-29T21:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244416#M27708</link>
      <description>&lt;P&gt;Are you able to read the logs via PS without getting the "enabled channel" error?   &lt;/P&gt;

&lt;P&gt;How/where does the CSV get purged?&lt;/P&gt;

&lt;P&gt;I took a similar approach with my mods (my log is set for retention) but I read the log in place and then pause it just long enough to clear it (and write the logs to STDOUT).    &lt;/P&gt;

&lt;P&gt;Separate issue - performance of the Get-WinEvent cmdlet was terrible for us ( a few thousand records every minute) so I had to resort to reading via .NET classes and formatting my own string.&lt;/P&gt;

&lt;P&gt;Is there a github site for this TA so that we could merge back some of these fixes? &lt;/P&gt;</description>
      <pubDate>Sun, 07 Oct 2018 18:03:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244416#M27708</guid>
      <dc:creator>hughkelley</dc:creator>
      <dc:date>2018-10-07T18:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244417#M27709</link>
      <description>&lt;P&gt;I have no issue reading the Events even when it is configured to overwrite the log. &lt;BR /&gt;
it does not purge the CSV file, i use the Getdate function to append the date to the file so if the file exists the new data will be appended to the existing file and it will create a new file everyday. &lt;BR /&gt;
you can use another process to deal with the older files. I personally delete the files older than 5 days.&lt;BR /&gt;
to avoid the performance issue, i have scheduled it to run every 5 minutes and developed the PS script to read the file starting from 5 minutes ago.&lt;BR /&gt;
it takes 60-70 seconds for our servers to append the new content for the past 5 minutes.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 18:20:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244417#M27709</guid>
      <dc:creator>mpasha</dc:creator>
      <dc:date>2018-10-09T18:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244418#M27710</link>
      <description>&lt;P&gt;OK, so the difference here is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Get-WinEvent -LogName 'Microsoft-Windows-DNSServer/Analytical' -Oldest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will throw error about busy channel.&lt;BR /&gt;
    Get-WinEvent : The requested operation cannot be performed over an enabled direct channel. The channel must first be disabled before performing the requested operation&lt;BR /&gt;
    At line:1 char:2&lt;BR /&gt;
    +  Get-WinEvent -LogName 'Microsoft-Windows-DNSServer/Analytical' -Olde ...&lt;BR /&gt;
    +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
        + CategoryInfo          : NotSpecified: (:) [Get-WinEvent], EventLogException&lt;BR /&gt;
        + FullyQualifiedErrorId : System.Diagnostics.Eventing.Reader.EventLogException,Microsoft.PowerShell.Commands.GetWinEventCommand&lt;/P&gt;

&lt;P&gt;And code below would work perfectly fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Get-WinEvent -Path C:\Windows\System32\winevt\Logs\Microsoft-Windows-DNSServer%4Analytical.etl -Oldest
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Oct 2018 13:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244418#M27710</guid>
      <dc:creator>exel_wild</dc:creator>
      <dc:date>2018-10-30T13:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244419#M27711</link>
      <description>&lt;P&gt;Good find.   &lt;/P&gt;

&lt;P&gt;For what it's worth,  we ultimately found that the performance of Get-WinEvent was terrible.   The time spent in FormatDescription()  seems to be the issue.    We ultimately rewrote the script a bit to bypass it and do the formatting ourselves.  We don't send the raw packet data to Splunk (didn't have time to work out the formatting for it).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$logName = 'Microsoft-Windows-DNSServer/Analytical'
$filterXPath = "*[System[EventID!=280] and EventData[Data[@Name='InterfaceIP']!='127.0.0.1']]"

$eventlogSettings = get-winevent -ListLog $logName
$logFile = [System.Environment]::ExpandEnvironmentVariables($eventlogSettings.LogFilePath)  # expand the variables in the file path


# Extract the DNS "message types" from the event provider into a sparse array (element number == event ID).   This is used later for our lightweight message generation
$prov = Get-WinEvent -ListProvider $eventlogSettings.OwningProviderName 
$messageTypes= new-object string[] 999  # no four-digit event IDs so we should be fine with 999
$prov.Events | %{

    $description = $_.Description -replace ";\s+PacketData=%\d+", ""  # remove packetdata  (for now,  too complicated to parse)
    $description = $description -replace "%(?&amp;lt;token&amp;gt;\d{1,2})", "{`${token}}"   # convert for PS-based tokens
    $messageTypes[$_.Id]  = $description
}

# Do not use Get-WinEvent to avoid performance overhead of FormatDescription()

$events = @()

$query = New-Object System.Diagnostics.Eventing.Reader.EventLogQuery($logFile,[System.Diagnostics.Eventing.Reader.PathType]::FilePath , $filterXPath);
$reader = New-Object System.Diagnostics.Eventing.Reader.EventLogReader($query)
while(($record = $reader.ReadEvent()) -ne $null)
{
    # convert the raw data to the format, without relying on EventLogRecord.FormatDescription () 
    $propVals=@($null)
    foreach($prop in $record.psbase.Properties)
    {
        $propVals += $prop.value
    }

    $record | Add-Member -MemberType NoteProperty -Name Message -Value ($messageTypes[$record.Id] -f $propVals)

    $events += $record
}

# emit for Splunk UF to parse
$events | fl 

# Clear the log
$logSize = $eventlogSettings.Filesize  # before clearing
$swLogPaused = [Diagnostics.Stopwatch]::StartNew()
$eventlogSettings.IsEnabled = $false
$eventlogSettings.SaveChanges()
try
{
    [System.Diagnostics.Eventing.Reader.EventLogSession]::GlobalSession.ClearLog($eventlogSettings.LogName) 
}
catch  [System.Management.Automation.MethodException]
{ # eat this exception.   It says "The process cannot access the file because it is being used by another process" but it lies, the log is cleared    
}
$eventlogSettings.IsEnabled = $true
$eventlogSettings.SaveChanges()
$swLogPaused.Stop()

# calculate the run time
$elapsedTimeSecs = (New-TimeSpan -Start (Get-Process -Id $pid).StartTime  -End (Get-Date)).Seconds  

# Emit some performance stats
[pscustomobject]@{
    LoggingPausedMs=$swLogPaused.Elapsed.Milliseconds;
    LogFileMaxBytes=$eventlogSettings.MaximumSizeInBytes
    LoggedBytes=$logSize
    LoggedRecs=$events.Count
    LoggedTimespanSecs=(New-TimeSpan -Start $events[0].timecreated -End $events[-1].timecreated).Seconds
    ScriptRunSecs=$elapsedTimeSecs
}   | fl 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Oct 2018 14:31:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244419#M27711</guid>
      <dc:creator>hughkelley</dc:creator>
      <dc:date>2018-10-30T14:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244420#M27712</link>
      <description>&lt;P&gt;Hey @hughkelley ,&lt;/P&gt;

&lt;P&gt;Since you are clearing out the log file via this script, how often are you running this?  (i.e. every x seconds,  minute, five minutes, 10 minutes, etc.)&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 18:13:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244420#M27712</guid>
      <dc:creator>robert_miller</dc:creator>
      <dc:date>2018-11-01T18:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244421#M27713</link>
      <description>&lt;P&gt;We currently run it every minute - and it sometimes runs as long as 20s.    I think we're going to filter further (possibly not logging results that were returned from authoritative zones).&lt;/P&gt;

&lt;P&gt;In addition to the CPU load on our DCs we're chewing up quite a bit of license volume.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 18:21:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244421#M27713</guid>
      <dc:creator>hughkelley</dc:creator>
      <dc:date>2018-11-01T18:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244422#M27714</link>
      <description>&lt;P&gt;We are using Stream, but we noticed the logs are not capturing the originating source which is why we are looking at the PS scripts suggested in this thread.  It makes it hard using these logs when you don't know which server is making the DNS request.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 19:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244422#M27714</guid>
      <dc:creator>robert_miller</dc:creator>
      <dc:date>2018-11-01T19:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244423#M27715</link>
      <description>&lt;P&gt;When the script runs as long as 20s, how much logs do you think are possibly not being captured? I noticed in your script you have "LoggingPausedMs"&amp;nbsp;which might help answer this question.  I am trying to determine if rolling the log file vs pausing/clearing is the right solution.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 19:10:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244423#M27715</guid>
      <dc:creator>robert_miller</dc:creator>
      <dc:date>2018-11-01T19:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Windows DNS Analytical and Diagnostic Logs: How are others monitoring DNS Analytical Logs?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244424#M27716</link>
      <description>&lt;P&gt;I think/fear we're missing that whole window.   My next move (in what seems like a never-ending saga of optimization) is to switch to the following method for clearing the log and then read/parse from that backup.   This will probably drive up the "paused" counter but should increase my visibility overall.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.eventing.reader.eventlogsession.clearlog?view=netframework-4.7.2#System_Diagnostics_Eventing_Reader_EventLogSession_ClearLog_System_String_System_String_"&gt;ClearLog (string logName, string backupPath);&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I'm open to other ideas.    One other thing I've observed,  these logs get really slow to read once they get too large.  I'd like to have a "clear" command that runs whenever the UF starts.   Otherwise, the script simply can't handle the pile of data that might be sitting there in the log.&lt;/P&gt;

&lt;P&gt;The original author of this TA doesn't seem to have it in GitHub/similar so I'm not sure how best to get all of our ideas back into the original work.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 19:53:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Windows-DNS-Analytical-and-Diagnostic-Logs-How-are-others/m-p/244424#M27716</guid>
      <dc:creator>hughkelley</dc:creator>
      <dc:date>2018-11-01T19:53:46Z</dc:date>
    </item>
  </channel>
</rss>

