6.6. 覆盖日志文件的默认路径
如果您修改默认容器和修改包含服务日志文件的路径,还必须修改默认的日志文件路径。每个可组合服务都有一个 < service_name>LoggingSource
参数。例如,对于 nova-compute 服务,参数是 NovaComputeLoggingSource
。
流程
要覆盖 nova-compute 服务的默认路径,请在配置文件中添加
NovaComputeLoggingSource
参数的路径。NovaComputeLoggingSource: tag: openstack.nova.compute path: /some/other/path/nova-compute.log
NovaComputeLoggingSource: tag: openstack.nova.compute path: /some/other/path/nova-compute.log
Copy to Clipboard Copied! Toggle word wrap Toggle overflow tag 和 path 属性是 <
service_name>LoggingSource 参数的必要
元素。在每个服务上,定义标签和路径,默认派生了其余值。您可以修改特定服务的格式。这会直接传递给 Fluentd 配置。
LoggingDefaultFormat
参数的默认格式为 /(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d+) (<pid>\d+) (<priority>\S+) (<message>.*)$/使用以下语法:<service_name>LoggingSource: tag: <service_name>.tag path: <service_name>.path format: <service_name>.format
<service_name>LoggingSource: tag: <service_name>.tag path: <service_name>.path format: <service_name>.format
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 以下片段是一个更复杂的转换示例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow