mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 23:37:18 +00:00
switch to explicit journald logger instead of syslog
This commit is contained in:
parent
f855e645cc
commit
8e0e57e193
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
|
# refresh the image
|
||||||
pacman --noconfirm -Syu
|
pacman --noconfirm -Syu
|
||||||
# main dependencies
|
# 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
|
# make dependencies
|
||||||
pacman --noconfirm -Sy python-build python-installer python-wheel
|
pacman --noconfirm -Sy python-build python-installer python-wheel
|
||||||
# optional dependencies
|
# optional dependencies
|
||||||
|
@ -6,7 +6,7 @@ ENV AHRIMAN_DEBUG=""
|
|||||||
ENV AHRIMAN_FORCE_ROOT=""
|
ENV AHRIMAN_FORCE_ROOT=""
|
||||||
ENV AHRIMAN_HOST="0.0.0.0"
|
ENV AHRIMAN_HOST="0.0.0.0"
|
||||||
ENV AHRIMAN_MULTILIB="yes"
|
ENV AHRIMAN_MULTILIB="yes"
|
||||||
ENV AHRIMAN_OUTPUT="syslog"
|
ENV AHRIMAN_OUTPUT="journald"
|
||||||
ENV AHRIMAN_PACKAGER="ahriman bot <ahriman@example.com>"
|
ENV AHRIMAN_PACKAGER="ahriman bot <ahriman@example.com>"
|
||||||
ENV AHRIMAN_PACMAN_MIRROR=""
|
ENV AHRIMAN_PACMAN_MIRROR=""
|
||||||
ENV AHRIMAN_PORT=""
|
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"
|
COPY "docker/install-aur-package.sh" "/usr/local/bin/install-aur-package"
|
||||||
## install package dependencies
|
## install package dependencies
|
||||||
## darcs is not installed by reasons, because it requires a lot haskell packages which dramatically increase image size
|
## 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 --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 && \
|
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 \
|
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
|
host = $AHRIMAN_HOST
|
||||||
|
|
||||||
EOF
|
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")
|
AHRIMAN_DEFAULT_ARGS=("--architecture" "$AHRIMAN_ARCHITECTURE")
|
||||||
if [[ "$AHRIMAN_OUTPUT" == "syslog" ]]; then
|
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
|
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.:
|
You can also edit configuration and forward logs to ``stderr``, just change ``handlers`` value, e.g.:
|
||||||
|
|
||||||
.. code-block:: shell
|
.. 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).
|
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')
|
arch=('any')
|
||||||
url="https://github.com/arcan1s/ahriman"
|
url="https://github.com/arcan1s/ahriman"
|
||||||
license=('GPL3')
|
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')
|
makedepends=('python-build' 'python-installer' 'python-wheel')
|
||||||
optdepends=('breezy: -bzr packages support'
|
optdepends=('breezy: -bzr packages support'
|
||||||
'darcs: -darcs packages support'
|
'darcs: -darcs packages support'
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
keys = root,http,stderr,boto3,botocore,nose,s3transfer
|
keys = root,http,stderr,boto3,botocore,nose,s3transfer
|
||||||
|
|
||||||
[handlers]
|
[handlers]
|
||||||
keys = console_handler,syslog_handler
|
keys = console_handler,journald_handler,syslog_handler
|
||||||
|
|
||||||
[formatters]
|
[formatters]
|
||||||
keys = generic_format,syslog_format
|
keys = generic_format,syslog_format
|
||||||
@ -13,6 +13,12 @@ level = DEBUG
|
|||||||
formatter = generic_format
|
formatter = generic_format
|
||||||
args = (sys.stderr,)
|
args = (sys.stderr,)
|
||||||
|
|
||||||
|
[handler_journald_handler]
|
||||||
|
class = systemd.journal.JournalHandler
|
||||||
|
level = DEBUG
|
||||||
|
formatter = syslog_format
|
||||||
|
kwargs = {"SYSLOG_IDENTIFIER": "ahriman"}
|
||||||
|
|
||||||
[handler_syslog_handler]
|
[handler_syslog_handler]
|
||||||
class = logging.handlers.SysLogHandler
|
class = logging.handlers.SysLogHandler
|
||||||
level = DEBUG
|
level = DEBUG
|
||||||
@ -29,12 +35,12 @@ datefmt =
|
|||||||
|
|
||||||
[logger_root]
|
[logger_root]
|
||||||
level = DEBUG
|
level = DEBUG
|
||||||
handlers = syslog_handler
|
handlers = journald_handler
|
||||||
qualname = root
|
qualname = root
|
||||||
|
|
||||||
[logger_http]
|
[logger_http]
|
||||||
level = DEBUG
|
level = DEBUG
|
||||||
handlers = syslog_handler
|
handlers = journald_handler
|
||||||
qualname = http
|
qualname = http
|
||||||
propagate = 0
|
propagate = 0
|
||||||
|
|
||||||
@ -45,24 +51,24 @@ qualname = stderr
|
|||||||
|
|
||||||
[logger_boto3]
|
[logger_boto3]
|
||||||
level = INFO
|
level = INFO
|
||||||
handlers = syslog_handler
|
handlers = journald_handler
|
||||||
qualname = boto3
|
qualname = boto3
|
||||||
propagate = 0
|
propagate = 0
|
||||||
|
|
||||||
[logger_botocore]
|
[logger_botocore]
|
||||||
level = INFO
|
level = INFO
|
||||||
handlers = syslog_handler
|
handlers = journald_handler
|
||||||
qualname = botocore
|
qualname = botocore
|
||||||
propagate = 0
|
propagate = 0
|
||||||
|
|
||||||
[logger_nose]
|
[logger_nose]
|
||||||
level = INFO
|
level = INFO
|
||||||
handlers = syslog_handler
|
handlers = journald_handler
|
||||||
qualname = nose
|
qualname = nose
|
||||||
propagate = 0
|
propagate = 0
|
||||||
|
|
||||||
[logger_s3transfer]
|
[logger_s3transfer]
|
||||||
level = INFO
|
level = INFO
|
||||||
handlers = syslog_handler
|
handlers = journald_handler
|
||||||
qualname = s3transfer
|
qualname = s3transfer
|
||||||
propagate = 0
|
propagate = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user