ELK Stack · Docs
Sending data

Sending data

Send structured events with the template examples.

Choose a language

  • Node.js: built-in fetch.
  • Python: standard-library HTTP.
  • Go: standard-library HTTP client.

Each program is copied from the template's examples/ directory. It sends an event using Basic auth, a bounded timeout, and no external libraries. These are small producers, not durable logging agents. They reject redirects and do not retry automatically.

Environment

Run the producer in the same Railway project and environment:

LOGSTASH_URL=http://${{Logstash.RAILWAY_PRIVATE_DOMAIN}}:8080
LOGSTASH_PASSWORD=${{Logstash.INPUT_PASSWORD}}

Keep resolved credentials in environment variables. Do not put them in source code or logs.

Event envelope

FieldSearch behavior
@timestampDate; added by Logstash when absent
messageFull-text search
service, levelKeyword search
attributesFlattened object with keyword values

Unknown top-level properties remain in _source but are not indexed. Put searchable custom properties inside attributes. Flattened values do not support numeric range semantics. Invalid mapped fields can be rejected during indexing. Malformed JSON is tagged _jsonparsefailure; HTTP acceptance is not schema validation.

Production producers

Use a durable local spool and bounded retries with exponential backoff and jitter. A retry after a timeout may duplicate an accepted event. Monitor indexing errors and queue occupancy. Confirm delivery in elk-logs Discover, not just from the HTTP response.

Local contract test

From the template repository, run python3 scripts/test_examples.py. The test supplies a loopback receiver and an in-memory credential. It does not validate Elasticsearch indexing or Kibana search.

On this page