Skip to content

Web Site Diagnostics

Guang Yang edited this page May 16, 2013 · 19 revisions

Draft

Configure Web Site Diagnostics

There are 2 kinds of diagnostics one can config for a web site:

  1. Site diagnostics: this is the diagnostics supported by the web server.
  2. Application diagnostics: this is the diagnostics people perform in their application via code.

Configure Site Diagnostics

azure site log config [options] [name]

Options

  • -w --webServerLogging: optional Use this flag to enable web server logging.
  • --no-webServerLogging: optional Use this flag to disable web server logging.
  • -e --detailedErrorMessages: optional Use this flag to enable detailed error messages.
  • --no-detailedErrorMessages: optional Use this flag to disable detailed error messages.
  • -f --failedRequestTracing: optional Use this flag to enable failed request tracing.
  • --no-failedRequestTracing: optional Use this flag to disable failed request tracing.

Notice

  • If a flag is not specified, the option will stay unchanged.
  • At least 1 of the 8 flags -w, -e, -f, -a and --no-* needs to be specified. (-a is in configure application diagnostics).

Examples

# Enable all the 3 site diagnostics options.
azure site log config -w -e -f
# Only disable web server logging. Other options remain unchanged.
azure site log config --no-webServerLogging

Configure Application Diagnostics

azure site log config --application [options] [name]

Options

  • -a --application: optional Use this flag to enable application diagnostics.
  • --no-application: optional Use this flag to disable application diagnostics.
  • -o --output: required when -a is specified. Takes file or storage. When -a is specified, use this parameter to specify the output of the log.
  • -l --level: optional Takes error, warning, verbose or info. When -a is specified, use this parameter to specify the log level. But default is error.
  • -s --storageAccount: required when -a is specified and -o is set to storage. Use this parameter to specify the storage account where the log will be stored.

Notice

  • At least 1 of the 8 flags -w, -e, -f, -a and --no-* needs to be specified. (-w, -e, -f are in configure site diagnostics).

Examples

# Enable application diagnostics to file.
azure site log config -a -o file -l error
# enable application diagnostics to storage
azure site log config -a -o storage -l warning -s mystorageaccount
# disable application diagnostics to file
azure site log config --no-application -o file
# disable application diagnostics to storage
azure site log config --no-application -o storage
# disable application diagnostics for both file and storage
azure site log config --no-application

Get Logs

Log Streaming from File System

azure site log tail [options] [name]

Options

  • -p, --path: the log path under LogFiles folder
  • -f, --filter: filter matching line

Examples

# streaming the log containing "error" in the message under "nodejs" folder
azure site log tail -p nodejs -f error

Query Log from Storage Table

azure site log get [options] [name]

Options

  • -l --level: optional Takes error, warning, verbose or info. Specify the level of the log you want to get. By default is info.
  • -f --filter: optional. Specify a string which the log message needs to match (sub string matching).
  • --start-time: optional. Specify the start time of the log you want to get.
  • --end-time: optional. Specify the end time of the log you want to get. By default is the time when you run the command.
  • -s --size: optional. Specify how many log do you want to return. By default is 100.
  • --no-paging optional. Specify to tell the command return without prompting for paging.

Paging

This command should provide the following options for paging after it returns the a certain page of the result:

  • next page: meaning the next n logs where n is specified by --size.
  • next one item: meaning the next 1 log
  • stop: meaning no further paging and return to console.

Examples

# get the first 50 logs between 5/5/2013 00:00:00 and 5/9/2013 13:00:00 which is in level error and contains "timeout" in the log message
azure site log get -l error -f timeout --start-time "5/5/2013 00:00:00" --end-time "5/9/2013 13:00:00" -size 50

Download Log

azure site log download [options] [name]

Options

  • -s --source: optional Specify where to download the log. Valid values are file and storage. By default is file.

File format for log from storage

Use 1 tab as delimiter between 2 columns.

Examples

azure site log download -s storage

Clear Log

azure site log clear [options] [name]

Options

  • --end-time: optional Specify the end time of the log that you want to delete.
  • -f --force: optional If not specified, the command will prompt for confirm. If specified, no prompt.

Notice

This command will only clear log from storage.

Examples

# delete all the logs older than 5/9/2013 13:00:00 without prompt for confirmation
azure site log clear --end-time "5/9/2013 13:00:00" -f