javasecurityjenkinsloggingaudit-trail

How to redirect jenkins.security.SecurityListener logs to a log file on a linux host


I have setup a logger on my jenkins server for jenkins.security.SecurityListener logs. I can view the logs in the webportal but I cannot find where the are stored on the server. I want to be able access these logs on the server.


Solution

  • I had the same issue -- wanted to redirect jenkins.security.SecurityListener output to a file.

    In my implementation I have Jenkins running on AWS as an ECS Fargate task. The /var/jenkins_home directory is mounted to an EFS filesystem. I also have a CloudWatch agent running alongside Jenkins mounting the same EFS access point. Any logs written to EFS can therefore be polled/monitored and transferred to CloudWatch.

    The best solution I found involved installing the 'Support Core' plugin -- it automatically redirects all logs (including custom configurations in System Log -> Log Recorders) into /var/jenkins_home/logs as well as a host of additional features.

    Caveat: the container logs (visible via docker logs <container_id>) are not written to a file by this plugin, to capture/view these outside the Jenkins UI, one of several AWS Log Drivers needs to be applied to your ECS task.

    Here is the page where I found the answer.