Tiven Wang
Wang Tiven December 05, 2017
425 favorite favorites
bookmark bookmark
share share

日志系统(Log)对于一个应用程序更是对一个云平台的 Maintainability 至关重要。 CloudFoundry Platform 也不例外,开发了她自己的日志管理系统 Loggregator

Image: loggregator architecture new

关于Loggregator详细的架构,对 CloudFoundry 平台管理感兴趣的读者可以详细研读其文档。本篇我们只介绍如何把 CloudFoundry 应用的日志收集到第三方日志管理系统中,以便进行详细分析。

Log Management Services

Cloud Foundry 支持众多第三方日志管理系统,包括 Logit.io, Papertrail, Splunk, Splunk Storm, SumoLogic, Logsene 等。我们不深入介绍各个系统的异同优劣,只介绍如何同 Cloud Foundry 配置起来。


Papertrail 相对比较简单易懂,作为入门比较合适。注册用户后访问链接 https://papertrailapp.com/systems/new 创建一个新的日志系统,选择 I use Cloud Foundry 你会得到提示:

CloudFoundry will log to logs6.papertrailapp.com:48899 and appear in CloudFoundry Events.

然后创建 CloudFoundry 的 User-Provided Service Instances

$ cf cups my-logs -l syslog-tls://logs6.papertrailapp.com:48899

-l 参数说明一个日志系统链接,应用程序可以往此链接上写入日志内容。

然后把此 User-Provided Service Instance 绑定给你需要输出日志的应用程序

$ cf bind-service cook my-logs

重启应用使配置生效,你便可以在这个第三方日志管理系统中看到 CloudFoundry 应用程序的日志了

$ cf restage cook

syslog URL

Cloud Foundry uses the syslog URL to route messages to the service. The syslog URL has a scheme of syslog, syslog-tls, or https, and can include a port number. For example: syslog://logs.example.com:1234

Elastic Runtime does not support using syslog-tls with self-signed certificates. If you are running your own syslog server and want to use syslog-tls, you must have an SSL certificate signed by a well-known certificate authority.







Similar Posts


Back to Top