0
votes

I need to know how to adjust one setting in IIS 8.5 that is under the logging icon. Within that section at the very bottom you have the section called "Log File Rollover." There is an option called "Do not create new log files." I have no idea to access that one option. I use the following code and I can get all the information from that section but that one option.

$test = Get-ItemProperty "IIS:\Sites\Default Web Site"
$test.logfile

enter image description here

I have looked at the Microsoft IIS documentation for logging and I can't find anything.

Any help is greatly appreciated.

1

1 Answers

1
votes

This particular setting is not clearly shown in the logFile object. It is a combination of settings. Property period should have a value of MaxSize and truncateSize should have the maximum allowable value for that field.

$test = Get-ItemProperty "IIS:\Sites\Default Web Site"
# returns True for Do not create new log files option
$test.logFile.truncateSize -eq 4gb-1 -and $test.logFile.period -eq 'MaxSize'

Note that my instance's maximum allowable log size is 4GB. Due to rounding, I could not solely rely on the 4gb output from PowerShell. One byte needed to be subtracted from the value. You can configure the settings for the required scenario using the following:

Set-ItemProperty 'IIS:\Sites\Default Web Site\' -Name logFile.period -value 'MaxSize'
Set-ItemProperty 'IIS:\Sites\Default Web Site\' -Name logFile.truncateSize -value $(4gb-1)