Knowledge BaseMetric InsightsSystem LoggingHow to move the log files from /var/log to a new location

How to move the log files from /var/log to a new location

If you need to move the log files from /var/log directory to a new location then follow these steps:

  1. Stop syslog.
    Run command in terminal to stop syslog (e.g. 'systemctl stop rsyslog.service')
  2. Edit the following file: /opt/mi/config/external/etc/rsyslog.d/metricinsights.conf
    Change all occurrences of '/var/log/' to your desired destination.
  3. Edit the following file: /app/mi/config/external/etc/logrotate.d/metricinsights
    Change all occurrences of '/var/log/' to match the destination set in step #2 above.
  4. Run the following command to move your log files and create symlinks to them:
    for x in log debug error; do mv /var/log/mi.$x /my/new/location/mi.$x  ln -sf /my/new/location/mi.$x /var/log/mi.$x; done
  5. Restart syslog.
    Run command in terminal to stop syslog (e.g. 
    'systemctl restart rsyslog.service' or 'service rsyslog restart')
  6. Update the LOGGING_SYSLOG_FILE_NAME config variable to reflect the new location of your log files.