共用方式為


Set parameters for a log

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

To set parameters for a log

  • Using the Windows interface

  • Using a command line

Using the Windows interface

  1. Open Performance.

  2. Double-click Performance Logs and Alerts.

  3. To set parameters for a counter log, double-click Counter Logs.

    Or, to set parameters for a trace log, double-click Trace Logs.

  4. In the details pane, double-click the log.

  5. On the Log Files tab, complete the following options:

    • Log file type. In the list, select the format you want for this log file, complete the options, and then click the Configure button. See "Quick reference to log file formats" under Related Topics for more information.

    • End file names with. Select this and choose the suffix style you want from the list. Use End file names with to distinguish between individual log files with the same log file name that are in a group of logs that have been automatically generated.

    • Start numbering at. Set this to the start number for automatic file numbering, when you select nnnnnn as the End file names with.

    • Comment. If appropriate, type a comment or description for the log file.

    • Overwrite existing log file. Select this check box if the log file should overwrite and replace the existing log file.

    • Configure. Select the configuration parameters using the following options for either Configure Log Files or Configure SQL Logs, based on the log file type selected from the drop-down menu.

      Option Description Applies to

      Location

      Type the name of the folder where you want the log file created, or click Browse to search for the folder.

      Configure Log Files

      File name

      Type a partial or base name for the log file. You can use File name in conjunction with End file names with if appropriate.

      Configure Log Files

      Repository name

      Select the System DSN (Data Source Name) from the drop-down list, and then type the Log set name. The Log set name will be stored in the database within the System DSN.

      Configure SQL Logs

  6. Log file size. Decide, using the following options, whether or not you want to limit the size of the log file.

  7. Or, under Log set size. Decide, using the following options, whether or not you want to limit the size of the log set.

    • Maximum limit. When you select this option, data is continuously collected in a log file until it reaches limits set by disk quotas or the operating system. (For SQL logs, data is collected in a database until it reaches its limits set by the number of records written.)

    • Limit of. To define a size limit for the log file, specify the size. For counter and trace logs, specify the maximum size in megabytes. For SQL logs, specify the maximum size in records.

Notes

  • To perform this procedure, you must be a member of the Administrators group, or the Performance Log Users group on the local computer, or you must have been delegated the appropriate authority. If the computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure. For more information, see Default local groups, Default groups, and Using Run as.

  • To open Performance, click Start, click Control Panel, double-click Administrative Tools, and then double-click Performance.

  • If you choose to allow the log file to grow to its maximum size, consider the available space on your disk and any quotas that may be in effect. An error might occur if you run out of disk space due to logging. The Log file size option works in conjunction with the When the log file is full option on the Schedule tab.

  • When you select a log file limit or log set size limit, the stop option When the log file is full reflects the size limit typed here.

  • The File name can identify a group of log files with similar parameters.

  • The End file names with suffix can be a numeric sequence or a character string indicating the date and time the log was started. For example, you might define the File name "DailyLog" and the Performance Logs and Alerts service would append the date as a suffix for each file so that you might have a series of files named as follows: DailyLog_19990715, DailyLog_19990716, for each day the log is run.

  • The comment text and the file name appear in the details pane in the Performance Logs and Alerts console window.

  • Sequential counter or trace log files can grow to a size larger than the maximum file size specified by the user. This can occur for different reasons, depending on the type of log configured. For counter logs, the log service postpones checking the log's file size until after it has collected the last data sample, at which point the file size might already have exceeded the defined limit. For trace logs, the log service writes additional buffers to the log when the log service stops, which can cause the final log file size to be slightly larger than the defined limit.

Using a command line

  1. Open Command Prompt

  2. Type the appropriate command below:

Command Action

logman updatecollection_name-f {bin | bincirc | csv | tsv | SQL}

Defines the log file format.

logman updatecollection_name-v {nnnnn | mmddhhmm}

Specify the file suffix.

logman updatecollection_name-vnnnnn

Set the automatic file numbering start number.

logman updatecollection_name-opath

Specify the location of the log file.

logman updatecollection_name-oDSN!counter_log

Specify the location of the SQL database and log set where output data will be written.

Value Description

update collection_name

Updates the collection query named collection_name. For counter collections, modifications to the query will stop, and then restart the collections.

-f bin | bincirc | csv | tsv | SQL

Specifies the file format used for collecting performance counter and trace data. You can use binary (bin), circular binary (circbin), comma (csv) and tab (tsv) separated, or SQL database (SQL) formats when collecting performance counters.

Note

  • For SQL database formats, you must use the -o option in the command line with the DNS!counter_log option, the System Database System Name (System DSN) must be predefined, and you must have Write permissions to the database. The log set counter_log is created in the database, and is specified by the DSN.

If a file format is not specified, it defaults to binary.

-vnnnnn | mmddhhmm

Attaches the version control information to the end of the output file and path name. Use numeric nnnnn format, or date format mmddhhmm (month, day, 24-hour, minute) for version control.

-opath

Specifies the path name of the output file that collects performance counter or trace data. By default, the collection log file name is the collection query name suffixed by either .blg for performance counters, or .etl for trace data.

-oDSN!counter_log

Specifies the location of the SQL database and log set.

For example, to specify that the output for counter collection perf_log be written to a SQL log set named daily_log in the perfdb database, type:

Logman update perf_log -f sql -o perfdb!daily_log

Notes

  • To perform this procedure, you must be a member of the Administrators group, or the Performance Log Users group on the local computer, or you must have been delegated the appropriate authority. If the computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure. For more information, see Default local groups, Default groups, and Using Run as.

  • To open a command prompt, click Start, point to All programs, point to Accessories, and then click Command prompt.

  • To view the complete syntax for this command, at a command prompt, type:

    logman /?

Information about functional differences

  • Your server might function differently based on the version and edition of the operating system that is installed, your account permissions, and your menu settings. For more information, see Viewing Help on the Web.

See Also

Concepts

Add counters to a log
Select trace log providers and events
Define start or stop parameters for a log or alert
Define trace log buffers
Quick reference to log file formats
Logman