ARTIFACTORY: How to change the location where the logs are written?

ARTIFACTORY: How to change the location where the logs are written?

AuthorFullName__c
Roi Niv
articleNumber
000005466
ft:sourceType
Salesforce
FirstPublishedDate
2022-11-23T13:10:37Z
lastModifiedDate
2023-01-22T11:07:11Z
VersionNumber
2

Artifactory log files are generated by several micro-services in Artifactory. The Java based services (Artifactory & Access)  logs are configured through the respective logback.xml file under $ARTIFACTORY_HOME/etc/artifactory/logback.xml for Artifactory service and $ARTIFACTORY_HOME/etc/access/logback.xml for Access service
 
You can modify the <File> element for each log file to change the location it is written.
 
Note that restarting Artifactory is not required after modifying the logback.xml
 
For example, to change the location of the artifactory-request.log file we will need to modify the default logback.xml that is attached below:

<appender name="REQUEST" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>${log.dir}/artifactory-request.log</File>
        <encoder>
            <pattern>%m%n</pattern>
        </encoder>
        <rollingPolicy class="org.jfrog.common.logging.logback.rolling.FixedWindowWithDateRollingPolicy">
            <FileNamePattern>${log.dir.archived}/artifactory-request.%i.log.gz</FileNamePattern>
        </rollingPolicy>
        <triggeringPolicy class="org.jfrog.common.logging.logback.triggering.SizeAndIntervalTriggeringPolicy">
            <MaxFileSize>25MB</MaxFileSize>
        </triggeringPolicy>
</appender>

The location of the log files are based on the β€œ<File>” element and β€œthe <FileNamePattern>” element (for the archived logs). These can be changed to modify the log files location, for example:
<appender name="REQUEST" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>/my/custom/path/artifactory-request.log</File>
        <encoder>
            <pattern>%m%n</pattern>
        </encoder>
        <rollingPolicy class="org.jfrog.common.logging.logback.rolling.FixedWindowWithDateRollingPolicy">
            <FileNamePattern>/my/custom/path/archived/artifactory-request.%i.log.gz</FileNamePattern>
        </rollingPolicy>
        <triggeringPolicy class="org.jfrog.common.logging.logback.triggering.SizeAndIntervalTriggeringPolicy">
            <MaxFileSize>25MB</MaxFileSize>
        </triggeringPolicy>
</appender>

The same can be applied to each <appender> element in the logback.xml file

For the other non Java services (such as Router/Metadata/Event) we need to modify the system.yaml file( under $JFROG_HOME/artifactory/var/etc/system.yaml).
By adding the filePath value to the system.yaml under each micro-service section, we can change where the logs are written.
You may visit our wiki for more options and instructions on how to modify your system.yaml file.

For example, to modify the location of router-service.log and router-request.log, the following need to be added to the system.yaml file:
router:
   logging:
       application:
          filePath: "/my/custom/path/router-service.log"
       request:
          filePath: "/my/custom/path/router-request.log"

Note that a restart of Artifactory is required after modifying the system.yaml file.

Please ensure that the new directories and files have the right permissions so Artifactory may access them.
The permissions should be read_write.
In addition, please make sure that the new directory has the same ownership as the original directory.