Skip to main content
Solved

Webhook data feed

  • Aug 14, 2024 12:34 PM UTC
  • 3 replies
  • 1253 views

Forum|alt.badge.img+6

Hi everyone,

I'm trying to ingest logs into Chronicle via a webhook Data feed, but I'm unsure how the API call should be structured on the client side that is push these logs. Could anyone provide documentation or an example of how this would look in a Python script?

Thanks for your help!

Best answer by mikewilusz

The documentation for webhooks includes examples of how to pass auth parameters. These can come in via headers or directly in the URL as parameters: https://cloud.google.com/chronicle/docs/administration/feed-management#webhook-endpoint-url

-mike

View original

3 replies

mikewilusz
Staff
Forum|alt.badge.img+10
  • Staff
  • Answer
  • Aug 14, 2024 3:27 PM UTC

The documentation for webhooks includes examples of how to pass auth parameters. These can come in via headers or directly in the URL as parameters: https://cloud.google.com/chronicle/docs/administration/feed-management#webhook-endpoint-url

-mike


Forum|alt.badge.img+6
  • Author
  • Bronze 5
  • Aug 14, 2024 8:59 PM UTC

The documentation for webhooks includes examples of how to pass auth parameters. These can come in via headers or directly in the URL as parameters: https://cloud.google.com/chronicle/docs/administration/feed-management#webhook-endpoint-url

-mike


Thx @mikewilusz for the swift response. So python script that sends logs to that webhook feed yould look like this ? 

import requests

# Webhook endpoint URL
url = "https://Webhook-feed-endpoint.com"

# Data to send in the POST request
data = {
"key1": "value1",
"key2": "value2"
}

# Custom headers
headers = {
"X-goog-api-key" = API_KEY
"X-Webhook-Access-Key" = SECRET
}

# Sending the POST request with custom headers
response = requests.post(url, json=data, headers=headers)

# Check the response status code and content
print("Status Code:", response.status_code)
print("Response Body:", response.text)


mikewilusz
Staff
Forum|alt.badge.img+10
  • Staff
  • Aug 15, 2024 12:30 PM UTC

As we say here at Google: LGTM! (looks good to me)

-mike