Logic app - Parse html table in order to send it to log analytics

Alon Keilin 141 Reputation points
2023-02-09T08:06:07.9733333+00:00

Hi team,

This logic app receives an email that contains logs from a certain system.

system logs to log analytics

As soon as there is more than one change in the system, the logs are received by email as a CSV file.

If only one change is detected, the log is received in the content of the email as follows:

logs

Logic App has a condition if the file contains a CSV file. if true, it will continue in the flow and send to log analytics.

If it is false, it means that the log was received in the content of the email in the HTML table.

What I want to know is how I can parse the HTML

So that I can extract only the table from the email so that I can send the table as a log to Log Analytics.

Thank you!

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2023-02-13T15:53:16.5833333+00:00

    @Alon Keilin Thanks for reaching out. As per the screenshot that you have shared, I can see the When an new email is arrived (V3) trigger so the email that you have shared is the one that you are reading on this trigger. Please correct me if my understanding is right. If this is the case, then this trigger returns this response which has the body parameter which contains the actual content of email in HTML format. Now as your requirement is to find some data in HTML body so there is no out of box feature that will help in your use case, so you need to leverage the regex expression to find the actual content, format the data as per your business need and then pass the formatted data to log analytics. You need to write your code as per your business need. You can either leverage the inline code to run the javascript custom code using regex or offload this functionality to your own custom service or azure function using your custom code. To test the regex expression online you can leverage this online tool or any of the tools that are available.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.