mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-10-30 21:33:43 +00:00 
			
		
		
		
	switch to explicit journald logger instead of syslog
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/setup.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/setup.sh
									
									
									
									
										vendored
									
									
								
							| @ -10,7 +10,7 @@ echo -e '[arcanisrepo]\nServer = http://repo.arcanis.me/$arch\nSigLevel = Never' | ||||
| # refresh the image | ||||
| pacman --noconfirm -Syu | ||||
| # main dependencies | ||||
| pacman --noconfirm -Sy base-devel devtools git pyalpm python-cerberus python-inflection python-passlib python-requests python-srcinfo sudo | ||||
| pacman --noconfirm -Sy base-devel devtools git pyalpm python-cerberus python-inflection python-passlib python-requests python-srcinfo python-systemd sudo | ||||
| # make dependencies | ||||
| pacman --noconfirm -Sy python-build python-installer python-wheel | ||||
| # optional dependencies | ||||
|  | ||||
| @ -6,7 +6,7 @@ ENV AHRIMAN_DEBUG="" | ||||
| ENV AHRIMAN_FORCE_ROOT="" | ||||
| ENV AHRIMAN_HOST="0.0.0.0" | ||||
| ENV AHRIMAN_MULTILIB="yes" | ||||
| ENV AHRIMAN_OUTPUT="syslog" | ||||
| ENV AHRIMAN_OUTPUT="journald" | ||||
| ENV AHRIMAN_PACKAGER="ahriman bot <ahriman@example.com>" | ||||
| ENV AHRIMAN_PACMAN_MIRROR="" | ||||
| ENV AHRIMAN_PORT="" | ||||
| @ -28,7 +28,7 @@ RUN useradd -m -d "/home/build" -s "/usr/bin/nologin" build && \ | ||||
| COPY "docker/install-aur-package.sh" "/usr/local/bin/install-aur-package" | ||||
| ## install package dependencies | ||||
| ## darcs is not installed by reasons, because it requires a lot haskell packages which dramatically increase image size | ||||
| RUN pacman -Sy --noconfirm --asdeps devtools git pyalpm python-cerberus python-inflection python-passlib python-requests python-srcinfo && \ | ||||
| RUN pacman -Sy --noconfirm --asdeps devtools git pyalpm python-cerberus python-inflection python-passlib python-requests python-srcinfo python-systemd && \ | ||||
|     pacman -Sy --noconfirm --asdeps python-build python-installer python-wheel && \ | ||||
|     pacman -Sy --noconfirm breezy mercurial python-aiohttp python-aiohttp-cors python-boto3 python-cryptography python-jinja python-requests-unixsocket rsync subversion && \ | ||||
|     runuser -u build -- install-aur-package python-aioauth-client python-aiohttp-apispec-git python-aiohttp-jinja2  \ | ||||
|  | ||||
| @ -15,7 +15,7 @@ database = $AHRIMAN_REPOSITORY_ROOT/ahriman.db | ||||
| host = $AHRIMAN_HOST | ||||
|  | ||||
| EOF | ||||
| sed -i "s|handlers = syslog_handler|handlers = ${AHRIMAN_OUTPUT}_handler|g" "/etc/ahriman.ini.d/logging.ini" | ||||
| sed -i "s|handlers = journald_handler|handlers = ${AHRIMAN_OUTPUT}_handler|g" "/etc/ahriman.ini.d/logging.ini" | ||||
|  | ||||
| AHRIMAN_DEFAULT_ARGS=("--architecture" "$AHRIMAN_ARCHITECTURE") | ||||
| if [[ "$AHRIMAN_OUTPUT" == "syslog" ]]; then | ||||
|  | ||||
| @ -974,13 +974,17 @@ It is automation tools for ``repoctl`` mentioned above. Except for using shell i | ||||
| How to check service logs | ||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||
|  | ||||
| By default, the service writes logs to ``/dev/log`` which can be accessed by using ``journalctl`` command (logs are written to the journal of the user under which command is run). | ||||
| By default, the service writes logs to ``/dev/log`` which can be accessed by using ``journalctl`` command (logs are written to the journal of the user under which command is run). In order to retrieve logs for the process you can use the following command: | ||||
|  | ||||
| .. code-block:: shell | ||||
|  | ||||
|    sudo journalctl SYSLOG_IDENTIFIER=ahriman | ||||
|  | ||||
| You can also edit configuration and forward logs to ``stderr``, just change ``handlers`` value, e.g.: | ||||
|  | ||||
| .. code-block:: shell | ||||
|  | ||||
|    sed -i 's/handlers = syslog_handler/handlers = console_handler/g' /etc/ahriman.ini.d/logging.ini | ||||
|    sed -i 's/handlers = journald_handler/handlers = console_handler/g' /etc/ahriman.ini.d/logging.ini | ||||
|  | ||||
| You can even configure logging as you wish, but kindly refer to python ``logging`` module `configuration <https://docs.python.org/3/library/logging.config.html>`_. The application uses java concept to log messages, e.g. class ``Application`` imported from ``ahriman.application.application`` package will have logger called ``ahriman.application.application.Application``. In order to e.g. change logger name for whole application package it is possible to change values for ``ahriman.application`` package; thus editing ``ahriman`` logger configuration will change logging for whole application (unless there are overrides for another logger). | ||||
|  | ||||
|  | ||||
| @ -7,7 +7,8 @@ pkgdesc="ArcH linux ReposItory MANager" | ||||
| arch=('any') | ||||
| url="https://github.com/arcan1s/ahriman" | ||||
| license=('GPL3') | ||||
| depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-cerberus' 'python-inflection' 'python-passlib' 'python-requests' 'python-srcinfo') | ||||
| depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-cerberus' 'python-inflection' 'python-passlib' 'python-requests' | ||||
|          'python-srcinfo' 'python-systemd') | ||||
| makedepends=('python-build' 'python-installer' 'python-wheel') | ||||
| optdepends=('breezy: -bzr packages support' | ||||
|             'darcs: -darcs packages support' | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| keys = root,http,stderr,boto3,botocore,nose,s3transfer | ||||
|  | ||||
| [handlers] | ||||
| keys = console_handler,syslog_handler | ||||
| keys = console_handler,journald_handler,syslog_handler | ||||
|  | ||||
| [formatters] | ||||
| keys = generic_format,syslog_format | ||||
| @ -13,6 +13,12 @@ level = DEBUG | ||||
| formatter = generic_format | ||||
| args = (sys.stderr,) | ||||
|  | ||||
| [handler_journald_handler] | ||||
| class = systemd.journal.JournalHandler | ||||
| level = DEBUG | ||||
| formatter = syslog_format | ||||
| kwargs = {"SYSLOG_IDENTIFIER": "ahriman"} | ||||
|  | ||||
| [handler_syslog_handler] | ||||
| class = logging.handlers.SysLogHandler | ||||
| level = DEBUG | ||||
| @ -29,12 +35,12 @@ datefmt = | ||||
|  | ||||
| [logger_root] | ||||
| level = DEBUG | ||||
| handlers = syslog_handler | ||||
| handlers = journald_handler | ||||
| qualname = root | ||||
|  | ||||
| [logger_http] | ||||
| level = DEBUG | ||||
| handlers = syslog_handler | ||||
| handlers = journald_handler | ||||
| qualname = http | ||||
| propagate = 0 | ||||
|  | ||||
| @ -45,24 +51,24 @@ qualname = stderr | ||||
|  | ||||
| [logger_boto3] | ||||
| level = INFO | ||||
| handlers = syslog_handler | ||||
| handlers = journald_handler | ||||
| qualname = boto3 | ||||
| propagate = 0 | ||||
|  | ||||
| [logger_botocore] | ||||
| level = INFO | ||||
| handlers = syslog_handler | ||||
| handlers = journald_handler | ||||
| qualname = botocore | ||||
| propagate = 0 | ||||
|  | ||||
| [logger_nose] | ||||
| level = INFO | ||||
| handlers = syslog_handler | ||||
| handlers = journald_handler | ||||
| qualname = nose | ||||
| propagate = 0 | ||||
|  | ||||
| [logger_s3transfer] | ||||
| level = INFO | ||||
| handlers = syslog_handler | ||||
| handlers = journald_handler | ||||
| qualname = s3transfer | ||||
| propagate = 0 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user