2021年4月24日星期六

systemd service not redirecting out to different log file

I have systemd service below, If I try to redirect application/service output to different files, it is not working. By default logs are redirecting to /var/log/messages, despite I defined log file in system service ( StandardOutput=file:/var/log/mylogfile.log and StandardError=file:/var/log/mylogerror.log)

Brief about mycode.py, it will generate logs and errors , but both are generating in /var/log/messages.

I need help to fix this issue

OS: Cent OS 7

rsyslog: service running

[Unit]  Description=my-apps  After=network.target    [Service]  User=root  Group=root  EnvironmentFile=/apps/config  WorkingDirectory=/apps  Environment="PATH=/apps/pyenv/bin/activate"  ExecStart=/apps/pyenv/bin/python /apps/mycode.py    StandardOutput=file:/var/log/mylogfile.log  StandardError=file:/var/log/mylogerror.log  
https://stackoverflow.com/questions/67248851/systemd-service-not-redirecting-out-to-different-log-file April 25, 2021 at 09:05AM

没有评论:

发表评论