CORD-1743: Make logging schema untyped, preserve legacy logging for now
Change-Id: Id29bb0488cec99a4d6349dd3c652fc54630356bd
diff --git a/README.md b/README.md
index dc673ad..0b93d3f 100644
--- a/README.md
+++ b/README.md
@@ -21,4 +21,3 @@
version is configured with a service graph that includes
`ExampleService`, which is a good platform for understanding how to
build and use XOS.
-
diff --git a/lib/xos-config/xosconfig/default.py b/lib/xos-config/xosconfig/default.py
index 70fa656..f1a7adc 100644
--- a/lib/xos-config/xosconfig/default.py
+++ b/lib/xos-config/xosconfig/default.py
@@ -17,10 +17,24 @@
DEFAULT_VALUES = {
'xos_dir': '/opt/xos',
'logging': {
- 'file': '/var/log/xos.log', # TODO remove me, the new logger will be able to decide on which file to log
- 'level': 'info',
- 'channels': ['file', 'console'],
- 'logstash_hostport': 'cordloghost:5617'
+ 'version': 1,
+ 'handlers': {
+ 'console': {
+ 'class': 'logging.StreamHandler',
+ },
+ 'file': {
+ 'class': 'logging.handlers.RotatingFileHandler',
+ 'filename': '/var/log/xos.log',
+ 'maxBytes': 10485760,
+ 'backupCount': 5
+ }
+ },
+ 'loggers': {
+ '': {
+ 'handlers': ['console', 'file'],
+ 'level': 'DEBUG'
+ }
+ }
},
'accessor': {
'endpoint': 'xos-core.cord.lab:50051',
@@ -34,9 +48,9 @@
'client_user': 'pl'
},
'proxy_ssh': {
- 'enabled': True,
- 'key': '/opt/cord_profile/node_key',
- 'user': 'root'
+ 'enabled': True,
+ 'key': '/opt/cord_profile/node_key',
+ 'user': 'root'
},
'node_key': '/opt/cord_profile/node_key',
'config_dir': '/etc/xos/sync',
diff --git a/lib/xos-config/xosconfig/synchronizer-config-schema.yaml b/lib/xos-config/xosconfig/synchronizer-config-schema.yaml
index ae7b83c..95a69b1 100644
--- a/lib/xos-config/xosconfig/synchronizer-config-schema.yaml
+++ b/lib/xos-config/xosconfig/synchronizer-config-schema.yaml
@@ -19,20 +19,8 @@
type: str
xos_dir:
type: str
- logging:
- type: map
- map:
- file:
- type: str
- logstash_hostport:
- type: str
- level:
- type: str
- channels:
- type: seq
- sequence:
- - type: str
- enum: ['file', 'console', 'elkstack']
+ logging:
+ type: any
dependency_graph:
type: str
link_graph:
diff --git a/lib/xos-config/xosconfig/xos-config-schema.yaml b/lib/xos-config/xosconfig/xos-config-schema.yaml
index 0319836..216bbf1 100644
--- a/lib/xos-config/xosconfig/xos-config-schema.yaml
+++ b/lib/xos-config/xosconfig/xos-config-schema.yaml
@@ -31,20 +31,7 @@
password:
type: str
required: True
- logging:
- type: map
- map:
- file:
- type: str
- logstash_hostport:
- type: str
- level:
- type: str
- # TODO add validation [info, debug, warning, error, critical]
- channels:
- type: seq
- sequence:
- - type: str
- enum: ['file', 'console', 'elkstack']
+ logging:
+ type: any
xos_dir:
type: str
diff --git a/xos/xos/logger.py b/xos/xos/logger.py
index 6bd62d4..d69062b 100644
--- a/xos/xos/logger.py
+++ b/xos/xos/logger.py
@@ -63,7 +63,7 @@
# Logstash config
try:
- logstash_host, logstash_port = Config.get("logging.logstash_hostport").split(':')
+ logstash_host, logstash_port = 'cordloghost', '5617'
logstash_handler = logstash.LogstashHandler(
logstash_host, int(logstash_port), version=1)
# always log at DEBUG level to logstash
@@ -74,10 +74,10 @@
# default is to locate loggername from the logfile if avail.
if not logfile:
- logfile = Config.get("logging.file")
+ logfile = '/var/log/xos_legacy.log'
# allow config-file override of console/logfile level
- level_str = Config.get("logging.level")
+ level_str = 'info'
if level_str:
level_str = level_str.lower()