简体   繁体   English

如何从 AWS 日志中读取 stderr 日志

[英]How to read stderr logs from AWS logs

I am using EMR steps to run my jobs.我正在使用 EMR 步骤来运行我的作业。 Typically when I want to analyze the performance of a job or to understand why it failed, I look at the spark history server for DAG visualizations, and job errors, etc. For example, if the job failed due to heap error, or Fetchfailed, etc, I can see it clearly specified in the spark history server.通常,当我想分析作业的性能或了解它失败的原因时,我会查看 Spark 历史服务器以获取 DAG 可视化和作业错误等。例如,如果作业由于堆错误或 Fetchfailed 而失败,等等,我可以在火花历史服务器中清楚地看到它。 However, I can't seem to be able to find such descriptions when I look at the stderr log files that are written to the LOG URI S3 bucket.但是,当我查看写入 LOG URI S3 存储桶的 stderr 日志文件时,我似乎无法找到此类描述。 Is there a way to obtain such information?有没有办法获得这样的信息? I use pyspark and set the log level to我使用pyspark并将日志级别设置为

sc = spark.sparkContext
sc.setLogLevel('DEBUG') 

Any insight as to what I am doing wrong?关于我做错了什么的任何见解?

I haven't really tested this but as it's a bit long to fit in a comment, I post it here as an answer.我还没有真正对此进行过测试,但是由于评论有点长,所以我将其发布在这里作为答案。

Like pointed out in my comment, the logs you're viewing using Spark History Server UI aren't the same as the Spark driver logs that are saved to S3 from EMR.正如我在评论中指出的那样,您使用 Spark History Server UI 查看的日志与从 EMR 保存到 S3 的Spark 驱动程序日志不同。

To get the spark history server logs written into S3, you'll have to add some additional configuration to your cluster.要将 spark 历史服务器日志写入 S3,您必须向集群添加一些额外的配置。 These configuration options are described in the section Monitoring and Instrumentation of Spark documentation.这些配置选项在 Spark 文档的监控和检测部分中进行了描述。

In AWS EMR, you could try to add something like this into your cluster configuration:在 AWS EMR 中,您可以尝试将类似这样的内容添加到您的集群配置中:

...

{
  'Classification': 'spark-defaults',
  'Properties': {
    'spark.eventLog.dir': 's3a://your_bucket/spark_logs',
    'spark.history.fs.logDirectory': 's3a://your_bucket/spark_logs',
    'spark.eventLog.enabled': 'true'
  }
}

...

I found this interesting post which describes how to set this for Kubernetes cluster, you may want to check it for further details.我发现这篇有趣的帖子描述了如何为 Kubernetes 集群设置它,您可能需要查看它以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM