< Back
Set-DbaErrorLogConfig
Post
NAME Set-DbaErrorLogConfig
SYNOPSIS
Set the configuration for the ErrorLog on a given SQL Server instance
SYNTAX
Set-DbaErrorLogConfig [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>
[[-SqlCredential] <Pscredential>] [[-LogCount] <Int>] [[-LogSize] <Int>] [-EnableException <Switch>]
[<CommonParameters>]
DESCRIPTION
Sets the number of log files configured on all versions, and size in KB in SQL Server 2012+ and above.
To set the Path to the ErrorLog, use Set-DbaStartupParameter -ErrorLog. Note that this command requires
remote, administrative access to the Windows/WMI server, similar to SQL Configuration Manager.
PARAMETERS
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-LogCount [<Int>]
Integer value between 6 and 99 for setting the number of error log files to keep for SQL Server instance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-LogSize [<Int>]
Integer value for the size in KB that you want the error log file to grow. This is feature only in SQL Server
2012 and higher. When the file reaches that limit SQL Server will roll the error log over.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory -
Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Instance, ErrorLog
Author: Shawn Melton (@wsmelton), https://wsmelton.github.com
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Set-DbaErrorLogConfig -SqlInstance sql2017,sql2014 -LogCount 25
Sets the number of error log files to 25 on sql2017 and sql2014
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-DbaErrorLogConfig -SqlInstance sql2014 -LogSize 102400
Sets the size of the error log file, before it rolls over, to 102400 KB (100 MB) on sql2014
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-DbaErrorLogConfig -SqlInstance sql2012 -LogCount 25 -LogSize 500
Sets the number of error log files to 25 and size before it will roll over to 500 KB on sql2012
RELATED LINKS
https://dbatools.io/Set-DbaErrorLogConfig
SYNOPSIS
Set the configuration for the ErrorLog on a given SQL Server instance
SYNTAX
Set-DbaErrorLogConfig [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>
[[-SqlCredential] <Pscredential>] [[-LogCount] <Int>] [[-LogSize] <Int>] [-EnableException <Switch>]
[<CommonParameters>]
DESCRIPTION
Sets the number of log files configured on all versions, and size in KB in SQL Server 2012+ and above.
To set the Path to the ErrorLog, use Set-DbaStartupParameter -ErrorLog. Note that this command requires
remote, administrative access to the Windows/WMI server, similar to SQL Configuration Manager.
PARAMETERS
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-LogCount [<Int>]
Integer value between 6 and 99 for setting the number of error log files to keep for SQL Server instance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-LogSize [<Int>]
Integer value for the size in KB that you want the error log file to grow. This is feature only in SQL Server
2012 and higher. When the file reaches that limit SQL Server will roll the error log over.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory -
Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Instance, ErrorLog
Author: Shawn Melton (@wsmelton), https://wsmelton.github.com
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Set-DbaErrorLogConfig -SqlInstance sql2017,sql2014 -LogCount 25
Sets the number of error log files to 25 on sql2017 and sql2014
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-DbaErrorLogConfig -SqlInstance sql2014 -LogSize 102400
Sets the size of the error log file, before it rolls over, to 102400 KB (100 MB) on sql2014
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-DbaErrorLogConfig -SqlInstance sql2012 -LogCount 25 -LogSize 500
Sets the number of error log files to 25 and size before it will roll over to 500 KB on sql2012
RELATED LINKS
https://dbatools.io/Set-DbaErrorLogConfig