16

有没有办法将 Dataproc Spark 作业的输出发送到 Google Cloud 日志记录?如 Dataproc 文档中所述,作业驱动程序(Spark 作业的主机)的输出可在控制台中的 Dataproc->Jobs 下获得。我希望在 Cloud Logging 中也有日志的原因有两个:

  1. 我想查看执行者的日志。通常主日志会说“executor lost”,没有更多细节,如果有更多关于 executor 正在做什么的信息会非常有用。
  2. Cloud Logging 具有出色的过滤和搜索功能

目前,Cloud Logging 中显示的唯一 Dataproc 输出是来自 yarn-yarn-nodemanager-* 和 container_*.stderr 的日志项。我的应用程序代码的输出显示在 Dataproc->Jobs 中,但没有显示在 Cloud Logging 中,而且它只是 Spark 主服务器的输出,而不是执行程序的输出。

4

2 回答 2

7

tl;博士

现在不原生支持,但未来版本的Cloud Dataproc 将原生支持。也就是说,在此期间有一个手动解决方法。

解决方法

Cloud Dataproc 集群使用fluentd收集日志并将其转发到 Cloud Logging。fluentd 的配置是为什么您看到一些日志被转发而不是其他日志的原因。因此,简单的解决方法(直到 Cloud Dataproc 支持 Cloud Logging 中的作业详细信息)是修改 flientd 配置。集群上 fluentd 的配置文件位于:

/etc/google-fluentd/google-fluentd.conf

有两件事可以收集最简单的其他详细信息:

  1. 根据您的需要添加新的fluentd 插件
  2. 将新文件添加到收集的现有文件列表中(行56包含我的集群上的文件)

编辑配置后,您需要重新启动google-fluentd服务:

/etc/init.d/google-fluentd restart

最后,根据您的需要,您可能需要也可能不需要在集群上的所有节点上执行此操作。根据您的用例,听起来您可能只需更改主节点并进行设置。

于 2015-12-09T21:11:12.550 回答
1

您可以为此使用 stackdriver 的 dataproc 初始化操作

gcloud dataproc clusters create <CLUSTER_NAME> \
    --initialization-actions gs://<GCS_BUCKET>/stackdriver.sh \
    --scopes https://www.googleapis.com/auth/monitoring.write
于 2018-01-15T11:15:10.167 回答