packages/o365_metrics/data_stream/app_registrations/agent/stream/cel.yml.hbs (129 lines of code) (raw):
config_version: 2
interval: {{interval}}
auth.oauth2:
client.id: {{client_id}}
client.secret: {{client_secret}}
provider: azure
scopes:
{{#each token_scopes as |token_scope|}}
- {{token_scope}}
{{/each}}
endpoint_params:
grant_type: client_credentials
{{#if token_url}}
token_url: {{token_url}}/{{azure_tenant_id}}/oauth2/v2.0/token
{{else if azure_tenant_id}}
azure.tenant_id: {{azure_tenant_id}}
{{/if}}
resource.url: {{url}}
{{#if resource_ssl}}
resource.ssl:
{{resource_ssl}}
{{/if}}
{{#if resource_timeout}}
resource.timeout: {{resource_timeout}}
{{/if}}
{{#if proxy_url}}
resource.proxy_url: {{proxy_url}}
{{/if}}
{{#if resource_retry_max_attempts}}
resource.retry.max_attempts: {{resource_retry_max_attempts}}
{{/if}}
{{#if resource_retry_wait_min}}
resource.retry.wait_min: {{resource_retry_wait_min}}
{{/if}}
{{#if resource_retry_wait_max}}
resource.retry.wait_max: {{resource_retry_wait_max}}
{{/if}}
{{#if resource_redirect_forward_headers}}
resource.redirect.forward_headers: {{resource_redirect_forward_headers}}
{{/if}}
{{#if resource_redirect_headers_ban_list}}
resource.redirect.headers_ban_list:
{{#each resource_redirect_headers_ban_list as |item|}}
- {{item}}
{{/each}}
{{/if}}
{{#if resource_redirect_max_redirects}}
resource.redirect.max_redirects: {{resource_redirect_max_redirects}}
{{/if}}
{{#if resource_rate_limit_limit}}
resource.rate_limit.limit: {{resource_rate_limit_limit}}
{{/if}}
{{#if resource_rate_limit_burst}}
resource.rate_limit.burst: {{resource_rate_limit_burst}}
{{/if}}
{{#if enable_request_tracer}}
resource.tracer.filename: "../../logs/cel/http-request-trace-*.ndjson"
{{/if}}
tags:
{{#each tags as |tag|}}
- {{tag}}
{{/each}}
{{#contains "forwarded" tags}}
publisher_pipeline.disable_host: true
{{/contains}}
{{#if processors}}
processors:
{{processors}}
{{/if}}
state:
want_more: false
redact:
fields: ~
program: |
state.with(
request(
"GET",
state.url + "/applications?$select=id,appId,displayName,passwordCredentials,keyCredentials"
).do_request().as(resp,
resp.StatusCode == 200
?
bytes(resp.Body).decode_json().as(body, {
"events": body.value.map(app,{
"o365": {
"metrics": {
"app_registrations": {
"object_id": app.id,
"display_name": app.displayName,
"app_id": app.appId,
"password_credentials": app.passwordCredentials.map(pc,
{
"display_name": pc.displayName,
"key_id": pc.keyId,
"end_date_time": pc.endDateTime
}
),
"key_credentials": app.keyCredentials.map(kc,
{
"display_name": kc.displayName,
"key_id": kc.keyId,
"end_date_time": kc.endDateTime,
"type": kc.type,
"usage": kc.usage
}
)
}
}
}
}
)
})
:
{
"events": {
"error": {
"code": string(resp.StatusCode),
"id": string(resp.Status),
"message": "GET:"+(
size(resp.Body) != 0 ?
string(resp.Body)
:
string(resp.Status) + ' (' + string(resp.StatusCode) + ')'
),
},
},
"want_more": false,
}
)
)