Loki icon

Loki

Interact with Loki

Overview

This node allows you to send log data to a Grafana Loki instance from your n8n workflow. It is designed for scenarios where you want to programmatically push logs—such as application events, error messages, or custom metrics—into Loki for centralized logging and analysis.

Common use cases:

  • Forwarding logs from various sources (e.g., webhooks, APIs) into Loki.
  • Automating the ingestion of structured or unstructured log data during workflow execution.
  • Enriching logs with dynamic labels for better querying in Grafana.

Practical examples:

  • Sending error logs from failed workflow steps to Loki for monitoring.
  • Pushing audit trails or user activity logs from n8n automations.
  • Aggregating logs from multiple services into a single Loki instance.

Properties

Name Type Meaning
URL string The endpoint of your Loki server (e.g., http://loki.example.com/). Required.
Specify Labels options Choose how to provide log labels: "Using Fields Below" (key-value pairs) or "Using JSON".
Labels fixedCollection List of label key-value pairs to attach to each log stream. Only shown if using fields below.
JSON json JSON object specifying all labels. Only shown if "Using JSON" is selected for labels.
Specify Logs options Choose how to provide log entries: "Using Fields Below" (timestamp/log pairs) or "Using JSON".
Logs fixedCollection List of log entries, each with a timestamp and value. Only shown if using fields below.
JSON json JSON array of log objects ([{timestamp, value}]). Only shown if "Using JSON" is selected.

Output

The node does not return any new data about the pushed logs; it simply passes through the input items unchanged. The output structure is identical to the input, with no additional fields added to the json property.

Note:

  • No binary data is produced by this node.

Dependencies

  • External Service: Requires access to a running Grafana Loki instance.
  • Network: The n8n instance must be able to reach the specified Loki URL.
  • Authentication: If your Loki instance requires authentication, you may need to configure headers or network settings accordingly (not handled directly by this node).

Troubleshooting

Common issues:

  • Invalid URL: If the Loki URL is incorrect or unreachable, requests will fail.
  • Malformed JSON: Providing invalid JSON in the "JSON" fields for labels or logs will cause errors.
  • Missing required fields: Not specifying required properties (like URL) will result in validation errors.
  • Loki API errors: If the Loki server returns an error (e.g., due to bad request format), the node will throw an error message from the HTTP response.

Error messages and resolutions:

  • "Unexpected token ... in JSON": Check that your JSON input is valid and properly formatted.
  • "Request failed with status code 4xx/5xx": Verify the Loki endpoint, network connectivity, and request body structure.
  • "Cannot read property 'parameters' of undefined": Ensure you have filled out the required fields for labels or logs.

Links and References

Discussion