sp_errorlog

Description

Dynamically changes the path of the error log.

Syntax

sp_errorlog “change log“, “new_path“ [,{“jslog true“ | “jslog false“}]
sp_errorlog “help”, “change log”

Parameters

new_path

new path of the error log. Maximum length of new_path is 255 characters.

jslog true

the default option. If the Job Scheduler is running, change log attempts to change the Job Scheduler Agent log to the directory where the new Adaptive Server error log will reside. Both logs will indicate error messages, if any.

jslog false

do not change the location of the Job Scheduler Agent log.

Examples

Example 1

To change the Adaptive Server error log to use a new location without changing the location of the Job Scheduler log, use:

sp_errorlog 'change log',
'$SYBASE/$SYBASE_ASE/install/new.log', 'jslog false'

Adaptive Server error log location is changed to $SYBASE/$SYBASE_ASE/install/new.log. However, the location of the Job Scheduler Agent log is not changed.

Example 2

This example changes the error log location to $SYBASE/$SYBASE_ASE/install/new.log.

If the Job Scheduler Agent is running, the agent log location is also changed to $SYBASE/$SYBASE_ASE/install/new.log.

If the Job Scheduler Agent is not running, Adaptive Server does not change the agent log location.You see a message that the agent log location is unchanged.

sp_errorlog 'change log',
'$SYBASE/$SYBASE_ASE/install/new.log', 'jslog true'

Example 3

This example changes the Adaptive Server error log to $SYBASE/$SYBASE_ASE/install/new.log.

If the Job Scheduler Agent is running, the agent log is also changed to $SYBASE/$SYBASE_ASE/install/new.log.

If the Job Scheduler Agent is not running, Adaptive Server does not change the path of the Job Scheduler Agent log. You do not see a message that the agent log location is unchanged.

sp_errorlog 'change log',
'$SYBASE/$SYBASE_ASE/install/new.log'

Usage

sp_errorlog returns 0 if the switch to the new location is successful. A non-zero return value implies an error.

NoteTo pick up the new location of the error log when the server is restarted, update the -e argument in the runserver file.

Permissions

The permission checks for sp_errorlog differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must be a user with manage server privilege.

Granular permissions disabled

With granular permissions disabled, you must be a user with sa_role.

Auditing

Use the errorlog auditing option to audit changes to the error log administration.

When the errorlog audit option is enabled, any change to the error log generates an audit record with event=127. To view the event from sybsecurity, issue:

select * from sybsecurity..sysaudits01 where event=127

To enable the errorlog audit option enter:

sp_audit 'errorlog', 'all', 'all', 'on'

See also

See Chapter 8, “Logging Error Messages and Events,” in the Configuration Guide for information on the runserver file.