Section 4 · Reading Alloy configuration

How a component block is written, and its inputs and outputs

Estimated time: 1 min

Arguments and exports

Every component has two main parts:

  • Arguments configure the component’s behavior. They are the attributes and nested blocks you write inside the component block.
  • Exports are values that the running component makes available for other components to reference. You don’t write exports in the configuration; the component type provides them.

A component can have zero or more exports, and optional arguments can have defaults.

Recall the local.file example:

Alloy
local.file "example" {
  filename = "/tmp/example.txt"
}

Here, filename is an argument that tells local.file which file to read. The local.file component also provides a content export, which holds the latest contents of that file.

Connecting components

When one component uses another component’s export as an argument, that reference connects the two. These connections are how components become the pipelines that collect, process, and send telemetry.