简体   繁体   English

如何通过另一个逻辑应用访问 Azure 逻辑应用运行日志

[英]How to access Azure logic app run log by another logic app

I have build an Integration between two systems using Azure Logic Apps.我已经使用 Azure 逻辑应用程序在两个系统之间构建了一个集成。 As per some Audit requirements I want to get Logic app run log into a kind of excel report and send it to Audit team by an another scheduled logic app in kind of Excel format.根据一些审核要求,我希望将逻辑应用程序运行日志转换为一种 excel 报告,并通过另一个计划的逻辑应用程序以 Excel 格式将其发送给审核团队。

So basically this is about accessing some Logic App's run log from another logic app..所以基本上这是关于从另一个逻辑应用程序访问一些逻辑应用程序的运行日志..

Can someone provide me a guidance on this??有人可以为我提供这方面的指导吗?

For this requirement, I can provide a sample for your reference:对于这个要求,我可以提供一个示例供您参考:

1. Create a "Log Analytics workspace" and add "Logic Apps Management" in it, you can refer to this tutorial . 1.创建一个“Log Analytics 工作区”并在其中添加“逻辑应用管理”,可以参考本教程

2. Create a new logic app and configure the "Diagnostic settings", please refer to the steps on this tutorial . 2.新建一个逻辑应用并配置“诊断设置”,请参考本教程的步骤。

3. After completing the configuration above, please wait for a few minutes and then run your logic app serval times for test (The logs in Log Analytics workspace will be a little bit of a delay, I wait for more than 30 minutes. It just show the logs of running instance which run after 30 minutes of the "Diagnostic settings" deployment). 3.完成以上配置后,请稍等几分钟,然后运行你的逻辑应用服务次数进行测试(Log Analytics 工作区中的日志会有一点延迟,我等了 30 多分钟。它只是显示在“诊断设置”部署 30 分钟后运行的实例的日志)。

4. Go to your "Log Analytics workspace", click "Workspace summary" --> "Logs". 4. Go 到您的“Log Analytics 工作区”,单击“工作区摘要”-->“日志”。 在此处输入图像描述

There are four query samples for logic app to query the logs, you can also write some other queries to query the logs which you want.逻辑应用有四个查询示例来查询日志,您还可以编写一些其他查询来查询您想要的日志。 在此处输入图像描述

I just use the third query sample to query the logs distribution by status, we can see there are two success and one failed.我只是使用第三个查询示例按状态查询日志分布,我们可以看到有两个成功和一个失败。 在此处输入图像描述

5. Then create another logic app to get the logs and generate the excel. 5.然后创建另一个逻辑应用程序来获取日志并生成 excel。 First add "Run query and list results(preview)" action and copy the query sample to the "Query" box.首先添加“运行查询并列出结果(预览)”操作并将查询示例复制到“查询”框中。 在此处输入图像描述 在此处输入图像描述

6. Run the logic app, we can see the logs result show as below format. 6.运行逻辑应用程序,我们可以看到日志结果显示如下格式。

{
  "value": [
    {
      "LogicAppName": "huryLogLogic",
      "NumberOfExecutions": 1,
      "RunStatus": "Failed",
      "Error": "ActionFailed"
    },
    {
      "LogicAppName": "huryLogLogic",
      "NumberOfExecutions": 2,
      "RunStatus": "Succeeded",
      "Error": ""
    }
  ]
}

7. As I don't know how to generate the excel in logic app, so in my logic app I generated csv instead. 7.由于我不知道如何在逻辑应用程序中生成 excel,所以在我的逻辑应用程序中我生成了 csv。 Use " Create CSV table " action to generate the csv.使用“ 创建 CSV 表”操作生成 csv。 在此处输入图像描述

8. After running the logic app, the logs in csv shown as below. 8.逻辑应用运行后,csv 中的日志如下图所示。 You can transfer the csv to your code or other service and convert it to excel.您可以将 csv 转移到您的代码或其他服务中,并将其转换为 excel。 在此处输入图像描述

Hope it helps~希望有帮助~

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

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