From eb5cc88b25f7ee4bd7c2faa149f0c9664413e56d Mon Sep 17 00:00:00 2001 From: ryanmerolle Date: Tue, 20 Apr 2021 07:46:29 -0400 Subject: [PATCH 1/7] Add expample plugin configuration --- .gitignore | 3 ++- configuration/plugins.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 configuration/plugins.py diff --git a/.gitignore b/.gitignore index 04dcc7e..4a44771 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ configuration/* !configuration/configuration.py !configuration/extra.py configuration/ldap/* -!configuration/ldap/ldap_config.py !configuration/ldap/extra.py +!configuration/ldap/ldap_config.py +!configuration/plugins.py prometheus.yml super-linter.log diff --git a/configuration/plugins.py b/configuration/plugins.py new file mode 100644 index 0000000..c11529f --- /dev/null +++ b/configuration/plugins.py @@ -0,0 +1,10 @@ +# Add your plugins and plugin settings here. +# Of course uncomment this file out. + +# PLUGINS = ["netbox_onboarding"] + +# PLUGINS_CONFIG = { +# "netbox_onboarding": { +# ADD YOUR SETTINGS HERE +# } +# } From 8176ef849948e140f4ca2a256703009a8959c24c Mon Sep 17 00:00:00 2001 From: ryanmerolle Date: Tue, 20 Apr 2021 07:46:39 -0400 Subject: [PATCH 2/7] Add expample logging configuration --- .gitignore | 1 + configuration/logging.py | 53 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 configuration/logging.py diff --git a/.gitignore b/.gitignore index 4a44771..9a5e13a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ configuration/* configuration/ldap/* !configuration/ldap/extra.py !configuration/ldap/ldap_config.py +!configuration/logging.py !configuration/plugins.py prometheus.yml super-linter.log diff --git a/configuration/logging.py b/configuration/logging.py new file mode 100644 index 0000000..ad6c03f --- /dev/null +++ b/configuration/logging.py @@ -0,0 +1,53 @@ +from os import environ + +# Set LOGLEVEL in netbox.env or docker-compose.overide.yml to override a logging level of INFO. +LOGLEVEL = environ.get('LOGLEVEL', 'INFO') + +LOGGING = { + + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'verbose': { + 'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}', + 'style': '{', + }, + 'simple': { + 'format': '{levelname} {message}', + 'style': '{', + }, + }, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse', + }, + }, + 'handlers': { + 'console': { + 'level': LOGLEVEL, + 'filters': ['require_debug_false'], + 'class': 'logging.StreamHandler', + 'formatter': 'simple' + }, + 'mail_admins': { + 'level': 'ERROR', + 'class': 'django.utils.log.AdminEmailHandler', + 'filters': ['require_debug_false'] + } + }, + 'loggers': { + 'django': { + 'handlers': ['console'], + 'propagate': True, + }, + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': False, + }, + 'django_auth_ldap': { + 'handlers': ['console',], + 'level': LOGLEVEL, + } + } +} From b69a97d2cafe46f4034e329aa7e1822d5896b168 Mon Sep 17 00:00:00 2001 From: ryanmerolle Date: Tue, 20 Apr 2021 07:48:41 -0400 Subject: [PATCH 3/7] add LOGLEVEL into netbox.env --- env/netbox.env | 1 + 1 file changed, 1 insertion(+) diff --git a/env/netbox.env b/env/netbox.env index 1f6f896..882a6db 100644 --- a/env/netbox.env +++ b/env/netbox.env @@ -14,6 +14,7 @@ EMAIL_USERNAME=netbox # EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`! EMAIL_USE_SSL=false EMAIL_USE_TLS=false +LOGLEVEL=INFO MAX_PAGE_SIZE=1000 MEDIA_ROOT=/opt/netbox/netbox/media METRICS_ENABLED=false From 9fab9a3434979468e1a4492df96e0ee94cd099f5 Mon Sep 17 00:00:00 2001 From: ryanmerolle Date: Tue, 20 Apr 2021 07:52:08 -0400 Subject: [PATCH 4/7] mention plugin wiki page in plugins.py comment --- configuration/plugins.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configuration/plugins.py b/configuration/plugins.py index c11529f..5cf1287 100644 --- a/configuration/plugins.py +++ b/configuration/plugins.py @@ -1,6 +1,9 @@ # Add your plugins and plugin settings here. # Of course uncomment this file out. +# To learn how to build images with your required plugins +# See https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins + # PLUGINS = ["netbox_onboarding"] # PLUGINS_CONFIG = { From 69dd87689c5db113cc83fc72f90bcf38c48e7a05 Mon Sep 17 00:00:00 2001 From: ryanmerolle Date: Tue, 20 Apr 2021 07:55:12 -0400 Subject: [PATCH 5/7] switch plugin example to netbox_bgp --- configuration/plugins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/plugins.py b/configuration/plugins.py index 5cf1287..c0b1a1f 100644 --- a/configuration/plugins.py +++ b/configuration/plugins.py @@ -4,10 +4,10 @@ # To learn how to build images with your required plugins # See https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins -# PLUGINS = ["netbox_onboarding"] +# PLUGINS = ["netbox_bgp"] # PLUGINS_CONFIG = { -# "netbox_onboarding": { +# "netbox_bgp": { # ADD YOUR SETTINGS HERE # } # } From 45889c3811bef9ab0bcceea69515891373c82f5b Mon Sep 17 00:00:00 2001 From: ryanmerolle Date: Fri, 23 Apr 2021 22:38:38 -0400 Subject: [PATCH 6/7] commented out the logging --- configuration/logging.py | 107 ++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/configuration/logging.py b/configuration/logging.py index ad6c03f..ec05c88 100644 --- a/configuration/logging.py +++ b/configuration/logging.py @@ -1,53 +1,54 @@ -from os import environ - -# Set LOGLEVEL in netbox.env or docker-compose.overide.yml to override a logging level of INFO. -LOGLEVEL = environ.get('LOGLEVEL', 'INFO') - -LOGGING = { - - 'version': 1, - 'disable_existing_loggers': False, - 'formatters': { - 'verbose': { - 'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}', - 'style': '{', - }, - 'simple': { - 'format': '{levelname} {message}', - 'style': '{', - }, - }, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse', - }, - }, - 'handlers': { - 'console': { - 'level': LOGLEVEL, - 'filters': ['require_debug_false'], - 'class': 'logging.StreamHandler', - 'formatter': 'simple' - }, - 'mail_admins': { - 'level': 'ERROR', - 'class': 'django.utils.log.AdminEmailHandler', - 'filters': ['require_debug_false'] - } - }, - 'loggers': { - 'django': { - 'handlers': ['console'], - 'propagate': True, - }, - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': False, - }, - 'django_auth_ldap': { - 'handlers': ['console',], - 'level': LOGLEVEL, - } - } -} +##Remove first comment(#) on each line to implement this working logging example. +#from os import environ +# +## Set LOGLEVEL in netbox.env or docker-compose.overide.yml to override a logging level of INFO. +#LOGLEVEL = environ.get('LOGLEVEL', 'INFO') +# +#LOGGING = { +# +# 'version': 1, +# 'disable_existing_loggers': False, +# 'formatters': { +# 'verbose': { +# 'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}', +# 'style': '{', +# }, +# 'simple': { +# 'format': '{levelname} {message}', +# 'style': '{', +# }, +# }, +# 'filters': { +# 'require_debug_false': { +# '()': 'django.utils.log.RequireDebugFalse', +# }, +# }, +# 'handlers': { +# 'console': { +# 'level': LOGLEVEL, +# 'filters': ['require_debug_false'], +# 'class': 'logging.StreamHandler', +# 'formatter': 'simple' +# }, +# 'mail_admins': { +# 'level': 'ERROR', +# 'class': 'django.utils.log.AdminEmailHandler', +# 'filters': ['require_debug_false'] +# } +# }, +# 'loggers': { +# 'django': { +# 'handlers': ['console'], +# 'propagate': True, +# }, +# 'django.request': { +# 'handlers': ['mail_admins'], +# 'level': 'ERROR', +# 'propagate': False, +# }, +# 'django_auth_ldap': { +# 'handlers': ['console',], +# 'level': LOGLEVEL, +# } +# } +#} From 96545135cba17169f20aafe56a4278f1216aaf2d Mon Sep 17 00:00:00 2001 From: ryanmerolle Date: Sun, 25 Apr 2021 16:38:03 -0400 Subject: [PATCH 7/7] remove example evn var for logging --- configuration/logging.py | 3 ++- env/netbox.env | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/logging.py b/configuration/logging.py index ec05c88..6be398f 100644 --- a/configuration/logging.py +++ b/configuration/logging.py @@ -1,4 +1,5 @@ -##Remove first comment(#) on each line to implement this working logging example. +## Remove first comment(#) on each line to implement this working logging example. +## Add LOGLEVEL environment variable to netbox if you use this example & want a different log level. #from os import environ # ## Set LOGLEVEL in netbox.env or docker-compose.overide.yml to override a logging level of INFO. diff --git a/env/netbox.env b/env/netbox.env index 882a6db..1f6f896 100644 --- a/env/netbox.env +++ b/env/netbox.env @@ -14,7 +14,6 @@ EMAIL_USERNAME=netbox # EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`! EMAIL_USE_SSL=false EMAIL_USE_TLS=false -LOGLEVEL=INFO MAX_PAGE_SIZE=1000 MEDIA_ROOT=/opt/netbox/netbox/media METRICS_ENABLED=false