Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure Logs] Fix event.original handling on Application Gateway and the generic Event Hub integration #5361

Merged
merged 3 commits into from
Feb 24, 2023

Conversation

zmoog
Copy link
Contributor

@zmoog zmoog commented Feb 22, 2023

What does this PR do?

Fix handling of the event.original in the last two Azure Logs that were missing it.

Some event forwarders (for example, Logstash) send both message and event.original fields, causing an error in the ingest pipeline.

With this change, the pipeline ensures there will only be the event.original field early in the pipeline.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

How to test this PR locally

Open the Dev Tools and send the following request to simulate the pipeline execution:

POST _ingest/pipeline/logs-azure.application_gateway-1.5.10/_simulate
{
  "docs": [
    {
      "tags":
      "_source": {
        "event": {
          "original": "{\"resourceId\":\"/SUBSCRIPTIONS/23103928-B2CF-472A-8CDB-0146E2849129/RESOURCEGROUPS/PEERINGTEST/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/Application-Gateway-Name\",\"operationName\":\"ApplicationGatewayAccess\",\"timestamp\":\"2017-04-26T19:27:38Z\",\"category\":\"ApplicationGatewayAccessLog\",\"properties\":{\"instanceId\":\"ApplicationGatewayRole_IN_0\",\"clientIP\":\"67.43.156.7\",\"clientPort\":46886,\"httpMethod\":\"GET\",\"requestUri\":\"/phpmyadmin/scripts/setup.php\",\"requestQuery\":\"X-AzureApplicationGateway-CACHE-HIT=0&SERVER-ROUTED=10.4.0.4&X-AzureApplicationGateway-LOG-ID=874f1f0f-6807-41c9-b7bc-f3cfa74aa0b1&SERVER-STATUS=404\",\"userAgent\":\"-\",\"httpStatus\":404,\"httpVersion\":\"HTTP/1.0\",\"receivedBytes\":65,\"sentBytes\":553,\"timeTaken\":205,\"sslEnabled\":\"off\",\"host\":\"www.contoso.com\",\"originalHost\":\"www.contoso.com\"}}"

        },
        "message": "{\"resourceId\":\"/SUBSCRIPTIONS/23103928-B2CF-472A-8CDB-0146E2849129/RESOURCEGROUPS/PEERINGTEST/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/Application-Gateway-Name\",\"operationName\":\"ApplicationGatewayAccess\",\"timestamp\":\"2017-04-26T19:27:38Z\",\"category\":\"ApplicationGatewayAccessLog\",\"properties\":{\"instanceId\":\"ApplicationGatewayRole_IN_0\",\"clientIP\":\"67.43.156.7\",\"clientPort\":46886,\"httpMethod\":\"GET\",\"requestUri\":\"/phpmyadmin/scripts/setup.php\",\"requestQuery\":\"X-AzureApplicationGateway-CACHE-HIT=0&SERVER-ROUTED=10.4.0.4&X-AzureApplicationGateway-LOG-ID=874f1f0f-6807-41c9-b7bc-f3cfa74aa0b1&SERVER-STATUS=404\",\"userAgent\":\"-\",\"httpStatus\":404,\"httpVersion\":\"HTTP/1.0\",\"receivedBytes\":65,\"sentBytes\":553,\"timeTaken\":205,\"sslEnabled\":\"off\",\"host\":\"www.contoso.com\",\"originalHost\":\"www.contoso.com\"}}"

      }
    }
  ]
}

The pipeline will run with no error and return a document.

Related issues

Relates

Some event forwarders (for example, Logstash) send both `message` and
`event.original` fields, causing an error in the ingest pipeline.

With this change, the pipeline ensures there will only be the
`event.original` field early in the pipeline.
@zmoog zmoog added bug Something isn't working Team:Cloud-Monitoring Label for the Cloud Monitoring team labels Feb 22, 2023
@zmoog zmoog self-assigned this Feb 22, 2023
@elasticmachine
Copy link

elasticmachine commented Feb 22, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-02-24T11:39:47.706+0000

  • Duration: 16 min 32 sec

Test stats 🧪

Test Results
Failed 0
Passed 124
Skipped 0
Total 124

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Feb 22, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (10/10) 💚
Files 86.364% (19/22) 👎 -13.636
Classes 86.364% (19/22) 👎 -13.636
Methods 83.333% (155/186) 👎 -12.568
Lines 84.93% (2801/3298) 👎 -3.888
Conditionals 100.0% (0/0) 💚

@zmoog zmoog marked this pull request as ready for review February 22, 2023 23:19
@zmoog zmoog requested a review from a team as a code owner February 22, 2023 23:19
@zmoog zmoog merged commit d1d79c4 into elastic:main Feb 24, 2023
@zmoog zmoog deleted the zmoog/fix-event-original branch February 24, 2023 12:29
@elasticmachine
Copy link

Package azure - 1.5.10 containing this change is available at https://epr.elastic.co/search?package=azure

agithomas pushed a commit to agithomas/integrations that referenced this pull request Mar 20, 2023
… the generic Event Hub integration (elastic#5361)

* Fix `event.original` handling

Some event forwarders (for example, Logstash) send both `message` and
`event.original` fields, causing an error in the ingest pipeline.

With this change, the pipeline ensures there will only be the
`event.original` field early in the pipeline.
agithomas pushed a commit to agithomas/integrations that referenced this pull request Mar 21, 2023
… the generic Event Hub integration (elastic#5361)

* Fix `event.original` handling

Some event forwarders (for example, Logstash) send both `message` and
`event.original` fields, causing an error in the ingest pipeline.

With this change, the pipeline ensures there will only be the
`event.original` field early in the pipeline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team:Cloud-Monitoring Label for the Cloud Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants