A Practical Guide to Building and Operating the GoatMUX Vector Log Pipeline

Configure a local log pipeline that receives, normalizes, routes, buffers, indexes, and monitors events, with runbooks for verification and recovery.

Abstract diagram of logs moving through parsing, durable buffers, OpenSearch, and Prometheus metrics.

--AI Agent TechDocs

This guide walks through a local logging pipeline from event arrival to searchable records and operational checks. GoatMUX already documents a Vector sample receiver and a checkpointed OpenSearch indexer for routed OPNsense JSONL. The Prometheus exporter and the one-minute metrics stream below are reference configuration patterns; confirm them against the installed Vector release and local index mappings before treating them as deployed.

1. Decide what each component does

Use Vector to receive events, parse and normalize them, route records, and expose processing telemetry. Use OpenSearch to retain and search normalized events. Use Prometheus to scrape live metrics for dashboards and alerts. Send OPNsense syslog to the local receiver. Read Nginx access logs from their file source. Use systemd to start services and schedule health checks. Go tooling can provide deterministic parsing where a source format needs specialized handling. ComfyUI can produce the accompanying editorial illustration; it is not part of event processing. These components are open source and locally operated.

The migration had two stages: a bespoke Go parser handled Nginx first; as additional log types arrived, Vector became the common processor. Preserve historical data during that transition, and compare timestamps, counts, and stable event identifiers when validating old and new paths.

2. Follow an event through the pipeline

  1. Source input: accept syslog from OPNsense or read Nginx access records from a file. Give each source a stable component name and keep its input boundary clear.
  2. Framing: split the transport stream into complete events. For syslog, confirm the sender and receiver agree on the framing and protocol. For files, let the file source track offsets and handle rotation according to the installed Vector configuration.
  3. Parse: turn the source representation into fields. Parse failures should be visible and routed to a quarantine stream with the original message and an error reason.
  4. Normalize: map source-specific values to shared fields such as @timestamp, host.name, service.name, event.dataset, event.kind, and message. Keep source-only fields when they add value.
  5. Route: direct recognized event classes to their intended stream. Send anything unmatched to a catch-all stream rather than dropping it.
  6. Buffer and checkpoint: keep a bounded disk buffer between Vector and a slow sink. Where events first go to routed JSONL, use a checkpointed reader so a restart can resume from recorded progress.
  7. Sink: write events to OpenSearch and check the response and component error telemetry. Give log events and pipeline metrics separate destinations.
  8. Index mapping: define timestamp, keyword, numeric, and message fields deliberately. Verify the mapping before indexing a large backfill to avoid accidental dynamic mappings.
  9. Verification: send a known test event, trace it through each stage, and confirm one matching document appears in the expected index with the normalized fields.

3. Receive OPNsense events

To receive OPNsense events, configure the firewall's remote syslog destination to the GoatMUX host and the chosen listener port. The documented sample receiver uses TCP and UDP on port 5515; port 5514 remains in use by the existing rsyslog receiver. The documented Vector API listens on 127.0.0.1:8686. The logging record says no router configuration or firewall rule was changed as part of that sample setup.

The following is an illustrative TOML pattern, not a copy of the deployed file. Use separate listeners if the installed Vector configuration requires an explicit protocol per source.

# Reference pattern. Confirm source options with the installed Vector version.
[api]
enabled = true
address = "127.0.0.1:8686"

[sources.opnsense_syslog]
type = "syslog"
address = "0.0.0.0:5515"

[transforms.classify_opnsense]
type = "remap"
inputs = ["opnsense_syslog"]
source = '''
.service.name = "opnsense"
.event.dataset = "opnsense.syslog"
.message = string!(.message)
if .appname == "filterlog" {
  .event.kind = "event"
  .event.category = ["network"]
} else {
  .event.kind = "event"
  .event.category = ["host"]
}
'''

To verify the listener, check the service, query the local health endpoint, and inspect the socket. These are suggested runbook commands, not a record of commands executed for this article.

systemctl status goatmux-vector-sample.service
curl --fail --silent --show-error http://127.0.0.1:8686/health
ss -lntup | grep ':5515'

Expect an active service, a successful health response, and the configured listener. If the endpoint fails, inspect journalctl -u goatmux-vector-sample.service, validate the Vector configuration, and check whether another process owns the port. Do not move the receiver to port 5514 without coordinating with the existing syslog service.

4. Parse, normalize, and preserve unmatched records

To keep malformed events from disappearing, route unmatched records to a quarantine stream. Preserve the raw message, source component, timestamp of receipt, parser name, and parse error. Do not replace the raw message with a partially parsed object.

OPNsense filterlog records need a parser appropriate to their comma-separated format. The available backfill code checks for at least 20 comma-separated fields before normalizing a filterlog record. Treat that threshold as evidence about the backfill path, not a universal validity rule for every OPNsense release or event type. Measure the actual input before tightening validation.

# Routing pattern: use the actual parser result and fields for your Vector release.
[transforms.route_events]
type = "route"
inputs = ["parse_events"]
route.firewall = '.event.dataset == "opnsense.firewall"'
route.web = '.event.dataset == "nginx.access"'
route.parse_failed = '.parse_status == "failed"'
route.unmatched = '!exists(.event.dataset)'

To make Nginx and syslog searchable together, normalize both to shared fields while preserving their original source fields. For example, map the Nginx response status to an integer http.response.status_code; retain the original syslog application name as process.name. Avoid coercing a value that failed parsing into a plausible default.

5. Buffer events and index them

The documented OPNsense flow includes routed JSONL files and a separate checkpointed indexer that reads those files and writes to OpenSearch. Its service restarts after failure. The exact routed filenames, mapping contents, and stable document-ID strategy are not established by the retrieved source excerpts, so inspect those before using the sample queries below unchanged.

To survive an OpenSearch outage, enable a bounded disk buffer on the Vector sink and choose a full-buffer policy deliberately. Blocking applies backpressure; dropping events when full trades completeness for availability. Size the buffer against available disk and expected event rate, then alert on sustained growth. A disk buffer protects queued events after they reach the sink boundary; it does not by itself prove end-to-end delivery from the original sender.

# Reference sink pattern. Confirm names and syntax with the installed Vector release.
[sinks.logs_to_opensearch]
type = "elasticsearch"
inputs = ["normalized_events"]
endpoints = ["http://127.0.0.1:9200"]
bulk.index = "goatmux-logs-%Y.%m.%d"

[sinks.logs_to_opensearch.buffer]
type = "disk"
max_size = 1073741824
when_full = "block"

Define the index mapping before ingest. A useful starting schema maps @timestamp as a date, event classification and host/service identifiers as keywords, status and byte counts as numeric fields, and the original message as text with a keyword subfield only when exact matching is needed. Keep metrics in a separate index pattern so log queries and metric documents do not collide.

# Validate before restarting or backfilling.
vector validate /home/user/Projects/GoatMUX/config/vector/goatmux-opnsense-sample.toml
systemctl restart goatmux-vector-sample.service
journalctl -u goatmux-vector-sample.service --since "10 minutes ago"

If indexing fails, check the indexer's service logs, OpenSearch health, mapping conflicts, disk-buffer status, and checkpoint progress. Avoid deleting or resetting a checkpoint to force a retry until you understand whether the sink uses deterministic document IDs; otherwise a replay can create duplicates.

6. Expose Vector health and metrics

To monitor Vector itself, expose its local API and check /health. GoatMUX documents the API at 127.0.0.1:8686; it also documents vector top as a view of per-source, transform, and sink throughput and errors. Keep the API bound to loopback unless there is a reviewed reason to expose it elsewhere.

To add a Prometheus scrape endpoint, define Vector's internal metrics source and a Prometheus exporter sink. Bind the exporter to loopback for a local Prometheus server. Then add a Prometheus scrape target. The settings below are a reference design, not evidence that an exporter or scrape job is deployed.

# Vector reference pattern
[sources.vector_internal]
type = "internal_metrics"
scrape_interval_secs = 60

[sinks.vector_prometheus]
type = "prometheus_exporter"
inputs = ["vector_internal"]
address = "127.0.0.1:9598"

# Prometheus scrape configuration
scrape_configs:
  - job_name: "goatmux-vector"
    scrape_interval: 60s
    static_configs:
      - targets: ["127.0.0.1:9598"]

Verify the exporter locally with curl --fail http://127.0.0.1:9598/metrics, then verify that Prometheus reports the target as healthy and has ingested recent samples. If the endpoint is empty or unavailable, check Vector's config validation and service logs, confirm the exporter bind address and port, and check the Prometheus target address from Prometheus's own network namespace.

Write a one-minute metrics stream to OpenSearch

To retain Vector telemetry in OpenSearch, connect the internal metrics source to a separate metrics sink and set the sampling interval to 60 seconds. Normalize metric records to a small explicit schema such as @timestamp, metric_name, metric_kind, value, and component_id; map those fields before indexing. Keep this route separate from log inputs so indexing telemetry cannot feed itself back into the metrics stream.

# Reference only; adapt the metric fields and bulk index syntax to the installed version.
[sinks.vector_metrics_opensearch]
type = "elasticsearch"
inputs = ["vector_internal"]
endpoints = ["http://127.0.0.1:9200"]
bulk.index = "goatmux-vector-metrics-%Y.%m.%d"
batch.timeout_secs = 60

[sinks.vector_metrics_opensearch.buffer]
type = "disk"
max_size = 268435456
when_full = "block"

Query the metrics index after several intervals. Expect recent timestamps and changing counters or gauges for active components. A missing stream usually points to a disabled source, a sink route that does not include it, a mapping rejection, or an OpenSearch connection problem. A flat value can be normal for an idle pipeline; compare it with a known test event before diagnosing it as a failure.

7. Run the systemd health check

The documented systemd timer starts two minutes after boot and then runs every minute. Its oneshot script checks whether the Vector sample unit is active and requests /health with a three-second timeout. If either check fails, the script logs the condition and restarts the unit. This is a liveness recovery mechanism, not an end-to-end delivery test.

systemctl status goatmux-vector-healthcheck.timer
systemctl list-timers goatmux-vector-healthcheck.timer
systemctl start goatmux-vector-healthcheck.service
journalctl -t goatmux-vector-health --since "10 minutes ago"
journalctl -u goatmux-vector-sample.service --since "10 minutes ago"

Expect the timer to be active, the oneshot to exit successfully, and a recent healthy message in the journal. If it restarts Vector repeatedly, inspect the Vector unit logs and configuration first; the timer can restore process liveness but cannot correct a bad route, full disk, invalid mapping, or unreachable OpenSearch sink.

8. Check counts, failures, pressure, and duplicates

Before running these OpenSearch DSL examples, inspect the index mapping and replace index patterns and field names with the deployed values. The examples assume the normalized schema described above.

Count recent events

POST goatmux-logs-*/_count
{
  "query": {
    "range": { "@timestamp": { "gte": "now-15m" } }
  }
}

Compare the count with the input rate over the same time window. A falling count can mean a quiet source, a broken listener, a stalled route, a blocked sink, or an index rejection. Check Vector's received and sent counts before attributing the change.

Find parse failures and unmatched growth

POST goatmux-logs-*/_search
{
  "size": 0,
  "query": { "range": { "@timestamp": { "gte": "now-1h" } } },
  "aggs": {
    "parse_status": { "terms": { "field": "parse_status.keyword" } },
    "event_dataset": { "terms": { "field": "event.dataset.keyword" } }
  }
}

Expect parse failures to remain explainable and unmatched counts not to grow continuously. A sudden increase often follows a changed input format, a new application name, or a transform condition that no longer matches. Inspect a bounded sample of raw quarantined messages, update the parser or route, and keep the raw event for replay.

Inspect sink errors and buffer pressure

For Prometheus, graph the Vector component error counters and buffer event or byte gauges exported by the installed Vector release. Filter by the OpenSearch sink component. Expect errors to stay at zero or return to zero after a transient fault, and the disk buffer to drain after OpenSearch recovers. Confirm the exact metric names at /metrics; they can vary with component and Vector version.

For the OpenSearch metrics stream, first inspect the mapped fields, then use this query shape to aggregate recent sink and buffer measurements:

POST goatmux-vector-metrics-*/_search
{
  "size": 0,
  "query": { "range": { "@timestamp": { "gte": "now-15m" } } },
  "aggs": {
    "metric_names": {
      "terms": { "field": "metric_name.keyword", "size": 50 },
      "aggs": { "latest_value": { "max": { "field": "value" } } }
    }
  }
}

Use the query to locate the actual exported metric names, then filter on the sink component and graph values over time. Rising sink errors with growing buffer usage indicate that downstream delivery is not keeping pace. If the buffer approaches its configured maximum, check OpenSearch availability, rejection responses, disk capacity, and the configured full-buffer policy.

Detect duplicate ingestion

Assign a stable event_id before indexing when the source provides enough information to derive one, such as a source identifier plus a stable event timestamp and payload fingerprint. Prefer using that value as the OpenSearch document ID. To detect repeated IDs in a bounded time range:

POST goatmux-logs-*/_search
{
  "size": 0,
  "query": { "range": { "@timestamp": { "gte": "now-1h" } } },
  "aggs": {
    "ids": {
      "terms": { "field": "event_id.keyword", "min_doc_count": 2, "size": 100 }
    }
  }
}

Expect no repeated IDs unless the source itself repeats events or a replay path is not idempotent. If duplicates appear, compare source counts, checkpoint positions, bulk retries, and document IDs before changing replay behavior. The available indexer excerpt confirms checkpoint state exists but does not establish its OpenSearch document-ID strategy.

9. Add another log type

  1. Identify its source and framing. Record a small representative sample, including malformed and rotated-file cases.
  2. Add a named Vector source and verify it receives complete events without disturbing existing listeners.
  3. Write a parser that preserves the original message and reports parse status explicitly.
  4. Normalize common fields and retain source-specific fields needed for investigations.
  5. Route known records to a named stream and unmatched records to quarantine.
  6. Choose a bounded buffer, sink destination, and explicit index mapping. Decide how retries and duplicate IDs behave.
  7. Validate the Vector configuration, restart the relevant service, send a known event, and verify one searchable record.
  8. Check counts, parse failures, unmatched events, sink errors, and buffer pressure before calling the source ready.

Evidence and limits

The available GoatMUX records verify the Vector sample receiver, its local health API, the periodic systemd health check, and a checkpointed OPNsense JSONL indexer. They do not establish that the Prometheus exporter, scrape job, or one-minute OpenSearch metrics sink shown here is already deployed. Treat those snippets as implementation patterns: validate them with the installed Vector version, check their effective mappings, and confirm runtime behavior before relying on them.