共用方式為


Create a counter log

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

To create a counter log

  • Using the Windows interface

  • Using a command line

Using the Windows interface

  1. Open Performance.

  2. Double-click Performance Logs and Alerts, and then click Counter Logs.

    Any existing counter logs will be listed in the details pane. A green icon indicates that a log is running; a red icon indicates that a log has stopped.

  3. Right-click a blank area of the details pane, and click New Log Settings.

  4. In Name, type the name of the counter log, and then click OK.

  5. On the General tab, click Add Objects and select the performance objects you want to add, or click Add Counters to select the individual counters you want to log.

    • You must use the Run as text box and Password button to collect counter data from a remotely managed computer. These features enable you to specify the logon account name for the log. You can access them from the General tab.
  6. If you want to change the default file and schedule information, make the changes on the Log Files tab and the Schedule tab.

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.

  • To save the settings for a counter log, trace log, or alert, right-click the log or alert in the details pane and click Save Settings As. You can then specify an .htm file in which to save the settings. To reuse the saved settings for a new log or alert, right-click the details pane, and then click New Log Settings From or New Alert Settings From. This is an easy way to generate new settings from a log or alert configuration. You can also open the HTML file in Internet Explorer to display a System Monitor graph.

  • Although the extension for a log file is .blg, the file format is changed in the Windows server 2003 family and therefore cannot be read on an earlier version of the operating system. For example, if you copy a binary file from Windows Server 2003, Standard Edition, to Windows 2000, you will be unable to read it on the latter system.

Using a command line

  1. Open Command Prompt

  2. Type:

    logman create countercollection_name-c {path [path...]} | {-cffilename}

Value Description

create counter collection_name

Creates a counter collection query named collection_name.

-c {path [path...]} | -cf {filename}

Specifies the performance counter path to log (path), or specifies the path name of the log file that lists these counters (-cffilename). To list multiple counter paths, separate the command line by a space, or use the -cf option to list counter paths in an input file, one per line. Use this format [\\computer]\object[instance]\counter] for each counter path where:

Computer is the optional computer name or the IP address of a remote computer. If a computer name is not supplied, the local computer will be used by default.

Object is the performance counter object (process or memory).

Instance (if any) is the performance object (process).

Counter is the performance counter for the object (processor time).

For example, to create a collection query named perf_log to collect Total % Processor Time counter data, type:

logman create counter perf_log -c "\Processor(_Total)\% Processor Time"

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
Set parameters for a log
Define start or stop parameters for a log or alert
Logman