Component Logging
Logging messages output by a component are categorized by scopes. A scope represents a set of related log messages which you can control as a whole. Different components have different scopes, depending on the features the component provides. All components have the scope, which is used for non-categorized log messages.
As an example, as of this writing, istioctl
has 25 scopes, representing different functional areas within the command:
ads
,adsc
,all
,analysis
,authn
,authorization
,ca
,cache
,cli
,default
,installer
, ,mcp
,model
,patch
,processing
,resource
,source
,spiffe
,tpath
,translator
,util
,validation
,validationController
,
Pilot-Agent, Pilot-Discovery, and the Istio Operator have their own scopes which you can discover by looking at their .
- error
- warn
- debug
where none
produces no output for the scope, and debug
produces the maximum amount of output. The default level for all scopes is info
which is intended to provide the right amount of logging information for operating Istio in normal conditions.
To control the output level, you use the --log_output_level
command-line option. For example:
In addition to controlling the output level from the command-line, you can also control the output level of a running component by using its ControlZ interface.
Log messages are normally output in a human-friendly format. The --log_as_json
option can be used to force the output into JSON, which can be easier for tools to process.
Istio control plane components can automatically manage log rotation, which make it simple to break up large logs into smaller log files. The --log_rotate
option lets you specify the base file name to use for rotation. Derived names will be used for individual log files.
The --log_rotate_max_age
option lets you specify the maximum number of days before file rotation takes place, while the --log_rotate_max_size
option let you specify the maximum size in megabytes before file rotation takes place. Finally, the --log_rotate_max_backups
option lets you control the maximum number of rotated files to keep, older files will be automatically deleted.