Configure Seafile to Use Syslog

Since community edition 5.1.2 and professional edition 5.1.4, Seafile support using Syslog.

Configure Syslog for Seafile Controller and Server

Add following configuration to general section in seafile.conf:

  1. [general]
  2. enable_syslog = true

Restart seafile server, you will find follow logs in /var/log/syslog:

  1. May 10 23:45:19 ubuntu seafile-controller[16385]: seafile-controller.c(154): starting ccnet-server ...
  2. May 10 23:45:19 ubuntu seafile-controller[16385]: seafile-controller.c(73): spawn_process: ccnet-server -F /home/plt/haiwen/conf -c /home/plt/haiwen/ccnet -f /home/plt/haiwen/logs/ccnet.log -d -P /home/plt/haiwen/pids/ccnet.pid
  1. May 12 01:00:51 ubuntu seaf-server[21552]: ../common/mq-mgr.c(60): [mq client] mq cilent is started
  2. May 12 01:00:51 ubuntu seaf-server[21552]: ../common/mq-mgr.c(106): [mq mgr] publish to hearbeat mq: seaf_server.heartbeat

Configure Syslog For Seafevents (Professional Edition only)

Add following configuration to seafevents.conf:

  1. [Syslog]
  2. enabled = true

Restart seafile server, you will find follow logs in /var/log/syslog

  1. May 12 01:00:52 ubuntu seafevents[21542]: [seafevents] database: mysql, name: seahub-pro
  2. May 12 01:00:52 ubuntu seafevents[21542]: seafes enabled: True
  3. May 12 01:00:52 ubuntu seafevents[21542]: seafes dir: /home/plt/pro-haiwen/seafile-pro-server-5.1.4/pro/python/seafes

Configure Syslog For Seahub

Add following configurations to seahub_settings.py:

  1. LOGGING = {
  2. 'version': 1,
  3. 'disable_existing_loggers': True,
  4. 'formatters': {
  5. 'verbose': {
  6. 'format': '%(process)-5d %(thread)d %(name)-50s %(levelname)-8s %(message)s'
  7. },
  8. 'standard': {
  9. 'format': '%(asctime)s [%(levelname)s] %(name)s:%(lineno)s %(funcName)s %(message)s'
  10. },
  11. 'simple': {
  12. 'format': '[%(asctime)s] %(name)s %(levelname)s %(message)s',
  13. 'datefmt': '%d/%b/%Y %H:%M:%S'
  14. },
  15. },
  16. 'filters': {
  17. 'require_debug_false': {
  18. '()': 'django.utils.log.RequireDebugFalse',
  19. },
  20. 'require_debug_true': {
  21. '()': 'django.utils.log.RequireDebugTrue',
  22. },
  23. },
  24. 'handlers': {
  25. 'console': {
  26. 'filters': ['require_debug_true'],
  27. 'class': 'logging.StreamHandler',
  28. 'formatter': 'simple'
  29. },
  30. 'syslog': {
  31. 'class': 'logging.handlers.SysLogHandler',
  32. 'address': '/dev/log',
  33. 'formatter': 'standard'
  34. },
  35. },
  36. 'loggers': {
  37. # root logger
  38. # All logs printed by Seahub and any third party libraries will be handled by this logger.
  39. '': {
  40. 'handlers': ['console', 'syslog'],
  41. 'level': 'INFO', # Logs when log level is higher than info. Level can be any one of DEBUG, INFO, WARNING, ERROR, CRITICAL.
  42. 'disabled': False
  43. },
  44. # This logger recorded logs printed by Django Framework. For example, when you see 5xx page error, you should check the logs recorded by this logger.
  45. 'django.request': {
  46. 'handlers': ['console', 'syslog'],
  47. 'level': 'INFO',
  48. 'propagate': False,
  49. },
  50. },
  51. }