【问题标题】:No incoming messages to Event Hub没有传入事件中心的消息
【发布时间】:2020-02-11 13:06:28
【问题描述】:

无法看到从 Azure AD 日志传入 Azure 事件中心的传入消息。我已经关注了下面的文章。

https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/tutorial-azure-monitor-stream-logs-to-event-hub

如果我在这里遗漏了什么,请告诉我。

下面是图片

AAD configuration to stream logs to Event Hub

No incoming messages in Azure Event hub

【问题讨论】:

    标签: azure azure-eventhub


    【解决方案1】:

    我尝试使用 Azure 门户工具读取消息,但最终我使用 DataBricks 或 Python 来完成,具体取决于具体情况。

    https://docs.microsoft.com/en-us/azure/databricks/spark/latest/structured-streaming/streaming-event-hubs https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-python-get-started-send

    非常简单(DataBricks scala 示例):

    import org.apache.spark.eventhubs.{ConnectionStringBuilder, EventHubsConf, EventPosition}
    import org.apache.spark.sql.functions._
    import java.time.{Clock, Instant}
    import java.time.temporal.ChronoUnit;
    import org.apache.spark.sql._
    
    
    
    //number of hours you want to display
    val hoursToDisplay = 24
    
    
    
    
     val ehConf = EventHubsConf(yourConnectionString)
            .setStartingPosition(EventPosition.fromEnqueuedTime(Instant.now.minus(hoursToDisplay,ChronoUnit.HOURS)))
              .setConsumerGroup(yourConsumerName)
    
    
    
    
    val input = spark.read.
              format("eventhubs").
              options(ehConf.toMap).
              load().
              select($"*" , $"body".cast("string").as("string_Casted_Body"))
    
    display(input)
    

    希望对你有帮助

    【讨论】:

    • 所以您最终会看到 DataBricks 摄取的事件?
    【解决方案2】:

    似乎有一些预期的延迟。 Azure AD 建议等待大约 15 分钟,然后再检查事件中心端的内容。你等的时间够吗?

    大约 15 分钟后,验证事件是否显示在您的事件中心。为此,请从门户转到事件中心并验证传入消息计数是否大于零。

    【讨论】:

    • 是的,我等了一整天,但没有运气。你能告诉我有什么问题吗?
    猜你喜欢
    • 1970-01-01
    • 2021-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-01
    • 1970-01-01
    • 2018-04-15
    • 2016-02-22
    相关资源
    最近更新 更多