Skip to content

Add custom logging option to Netbox configuration #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tests/*.retry
/.cache
/venv
/.venv
/.ansible
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "/opt/homebrew/bin/python3"
}
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,7 @@ netbox_time_format:
short_time: H:i:s
datetime: N j, Y g:i a
short_datetime: Y-m-d H:i

# Netbox custom Logging configuration
# This is a JSON dict with the logging configuration
netbox_logging_config: {}
2 changes: 1 addition & 1 deletion tasks/install.amazon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
when: not amazon_extras_repo.stat.exists or amzn2extras is failed

- name: install.amazon | install tar
ansible.builtin.yum:
ansible.builtin.yum: # noqa:fqcn[action-core]
name: tar
state: present
when: netbox_install_method != 'git'
8 changes: 4 additions & 4 deletions tasks/install.redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- ansible_distribution_major_version == '9'

- name: install.redhat | install required system packages
ansible.builtin.yum:
ansible.builtin.yum: # noqa:fqcn[action-core]
name: "{{ item }}"
state: present
loop:
Expand All @@ -38,18 +38,18 @@
- redhat-rpm-config

- name: install.redhat | install required python packages
ansible.builtin.yum:
ansible.builtin.yum: # noqa:fqcn[action-core]
name: "{{ python_packages }}"
state: present

- name: install.redhat | install Git
ansible.builtin.yum:
ansible.builtin.yum: # noqa:fqcn[action-core]
name: git
state: present
when: netbox_install_method == 'git'

- name: install.redhat | install system packages for LDAP authentication
ansible.builtin.yum:
ansible.builtin.yum: # noqa:fqcn[action-core]
name: "{{ item }}"
state: present
loop:
Expand Down
5 changes: 5 additions & 0 deletions templates/configuration.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ INTERNAL_IPS = ('{{netbox_internal_ips|join("', '")}}')

# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
# https://docs.djangoproject.com/en/stable/topics/logging/
{% if netbox_logging_config != {} %}
import logging.handlers
LOGGING = {{ netbox_logging_config|to_json }}
{% else %}
LOGGING = {}
{% endif %}

LOGIN_PERSISTENCE = {{ netbox_logging_persistence }}

Expand Down
Loading