Cycle.io Log Drains
cycle.io HTTP/S log drains buffer log messages and submit batches of messages to an HTTPS endpoint via a POST request. The POST body contains NDJSON formatted log messages.
Middleware’s HTTP API implements and understands the NDJSON formatted messages and can extract additional metadata sent by cycle.io in HTTP POST headers to enrich log messages.
Steps
1 Navigate to Container Log Drains Configuration
Log in to your cycle.io account and navigate to Environments
> <environment-name>
> Containers
> <container-name>
> Config
> Integrations
.
<environment-name>
and <container-name>
are the names of the cycle.io Environment and Container for which you want to configure Log Drains.
2 Enable Instance Logs Customization
Under Integrations
, enable Instance Logs Customization
integration option. The integration option will look like below
3 Configure Log Drain URL
Under Drain URL
, enter the URL below
https://your-initial-id.middleware.io/v1/plugins/logs/cycleio?mw-api-key=<MW_API_KEY>
Attribute Overrides
Middleware automatically extracts metadata from cycle.io log messages and adds following attributes. You can override these attributes by passing in relevant query parameters in the Drain URL
as listed below
- Service Name: Use
service
query parameter to overrideservice.name
attribute for your log messages. - Application Name: Use
app
query parameter to overrideapp.name
attribute for your log messages. - Source: Use
source
query paratmer to overridesource
attribute for your log messages.
Below is an example of the Drain URL
with attribute overrides
https://your-initial-id.middleware.io/v1/plugins/logs/cycleio?mw-api-key=<MW_API_KEY>&service=my-service&app=my-app&source=my-source
Custom attributes:
You can add custom attributes to your logs by passing additional query parameters in the Drain URL
as follows:
https://your-initial-id.middleware.io/v1/plugins/logs/cycleio?mw-api-key=<MW_API_KEY>&my-attribute=my-value
In the above command, my-attribute
in query parameter is the custom attribute and my-value
is the value for that attribute.
Middleware platform limits the number of custom attributes to 50. This includes any of the attribute overrides mentioned in the previous section.