feat: Add log_file config into skyline.yaml.sample

Add log_file config. Now log path of skyline is log_dir
with log_file, no other hardcode path.

Change-Id: Ieb1fd567e02110238568840fe3641770def0994d
This commit is contained in:
Boxiang Zhu 2022-10-19 17:29:14 +08:00
parent 1edaacf735
commit fb1d6d8d4b
12 changed files with 26 additions and 13 deletions

View File

@ -86,9 +86,9 @@ Deployment with Sqlite
.. code:: bash
rm -rf /tmp/skyline && mkdir /tmp/skyline
rm -rf /tmp/skyline && mkdir /tmp/skyline && mkdir /var/log/skyline
docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /var/log/skyline:/var/log/skyline -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
# Check bootstrap is normal `exit 0`
docker logs skyline_bootstrap
@ -105,7 +105,7 @@ Deployment with Sqlite
.. code:: bash
docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
docker run -d --name skyline --restart=always -v /var/log/skyline:/var/log/skyline -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
Deployment with MariaDB
~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -124,7 +124,7 @@ function configure_skyline {
# devstack will not create internal interface
# we can see more details from devstack/lib/keystone
_skyline_config_set $SKYLINE_CONF_FILE "interface_type: *.*" "interface_type: public"
_skyline_config_set $SKYLINE_CONF_FILE "log_dir: *.*" "log_dir: /var/log"
_skyline_config_set $SKYLINE_CONF_FILE "log_dir: *.*" "log_dir: $SKYLINE_LOG_DIR"
}
# create_skyline_accounts() - Create required service accounts

View File

@ -19,6 +19,4 @@ GITDIR["skyline-console"]=$DEST/skyline-console
SKYLINE_CONF_DIR=${SKYLINE_CONF_DIR:-/etc/skyline}
SKYLINE_CONF_FILE=${SKYLINE_CONF_DIR}/skyline.yaml
SKYLINE_LOG_DIR=/var/log/skyline
SKYLINE_ERROR_LOG_FILE=${SKYLINE_LOG_DIR}/error.log
SKYLINE_ACCESS_LOG_FILE=${SKYLINE_LOG_DIR}/access.log
SKYLINE_RUN_DIR=/var/lib/skyline

View File

@ -16,6 +16,7 @@ file ``skyline.yaml.sample`` in ``etc`` directory.
database_url: sqlite:////tmp/skyline.db
debug: false
log_dir: ./log
log_file: skyline.log
prometheus_basic_auth_password: ''
prometheus_basic_auth_user: ''
prometheus_enable_basic_auth: false

View File

@ -115,7 +115,7 @@ We will install the Skyline APIServer service from docker image.
default:
database_url: mysql://skyline:SKYLINE_DBPASS@DB_SERVER:3306/skyline
debug: true
log_dir: /var/log
log_dir: /var/log/skyline
openstack:
keystone_url: http://KEYSTONE_SERVER:5000/v3/
system_user_password: SKYLINE_SERVICE_PASSWORD

View File

@ -137,7 +137,7 @@ We will install the Skyline APIServer service from source code.
default:
database_url: mysql://skyline:SKYLINE_DBPASS@DB_SERVER:3306/skyline
debug: true
log_dir: /var/log
log_dir: /var/log/skyline
openstack:
keystone_url: http://KEYSTONE_SERVER:5000/v3/
system_user_password: SKYLINE_SERVICE_PASSWORD

View File

@ -44,12 +44,12 @@ logconfig_dict = {
"error_file": {
"class": "logging.handlers.RotatingFileHandler",
"formatter": "generic",
"filename": "/var/log/skyline/error.log",
"filename": "/var/log/skyline/skyline-error.log",
},
"access_file": {
"class": "logging.handlers.RotatingFileHandler",
"formatter": "generic",
"filename": "/var/log/skyline/access.log",
"filename": "/var/log/skyline/skyline-access.log",
},
"console": {
"class": "logging.StreamHandler",

View File

@ -5,6 +5,7 @@ default:
database_url: sqlite:////tmp/skyline.db
debug: false
log_dir: ./log
log_file: skyline.log
prometheus_basic_auth_password: ''
prometheus_basic_auth_user: ''
prometheus_enable_basic_auth: false

View File

@ -0,0 +1,5 @@
---
features:
- |
Add ``log_file`` config into skyline.yaml.sample. Now the log
path of skyline is log_dir with log_file, no other hardcode path.

View File

@ -34,6 +34,13 @@ log_dir = Opt(
default="./log",
)
log_file = Opt(
name="log_file",
description="Log file",
schema=StrictStr,
default="skyline.log",
)
secret_key = Opt(
name="secret_key",
description="Secret key",
@ -115,6 +122,7 @@ GROUP_NAME = __name__.split(".")[-1]
ALL_OPTS = (
debug,
log_dir,
log_file,
secret_key,
access_token_expire,
access_token_renew,

View File

@ -32,7 +32,7 @@ PROJECT_NAME = "Skyline API"
async def on_startup() -> None:
configure("skyline")
log_setup(
Path(CONF.default.log_dir).joinpath("skyline", "skyline-apiserver.log"),
Path(CONF.default.log_dir).joinpath(CONF.default.log_file),
debug=CONF.default.debug,
)
policies_setup()

View File

@ -44,8 +44,8 @@ http {
'"$upstream_response_time" "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log {{ log_dir | default('/var/log') }}/skyline/nginx_access.log main;
error_log {{ log_dir | default('/var/log') }}/skyline/nginx_error.log;
access_log {{ log_dir | default('/var/log/skyline') }}/skyline-nginx-access.log main;
error_log {{ log_dir | default('/var/log/skyline') }}/skyline-nginx-error.log;
##
# Gzip Settings