# streamview > streamview shows the events of a system on a live timeline in the browser: the messages of Kafka topics, NATS subjects, and RabbitMQ exchanges, webhooks, and the JSON output of each command. The data does not need a special format. It is open source (Apache-2.0), and it is made by EventCatalog. - streamview is one program for macOS and Linux. There is also a container image. The Kafka, NATS, and RabbitMQ commands need Node.js. - Install: `curl -fsSL https://github.com/event-catalog/streamview/releases/latest/download/install.sh | sh` - The documentation is in the program also, for the version that is installed: `streamview docs` gives the list of pages, `streamview docs NAME` gives one page, and `streamview docs --search TEXT` finds a word. Read it before this website, which has the documentation of the latest version. - Start with made-up events: `streamview demo` - Kafka: `streamview kafka --brokers localhost:9092` - NATS: `streamview nats --servers localhost:4222` - RabbitMQ: `streamview rabbitmq --url amqp://localhost` - Webhooks: `streamview webhooks`. Give each service the address `/webhooks/NAME`. streamview makes one event from each webhook. - A file or a different program: `my-program | streamview serve -`, with one CloudEvent or one plain JSON record on each line. - The output of a command that prints JSON objects, for example a log file: `tail -n +1 -f app.log | streamview serve - --type-field event --time-field ts` - An archive in an S3 bucket: `aws s3 cp s3://my-bucket/events.json.gz - | streamview serve - --type-field eventType --time-field occurredAt --sort` - A lane can have an icon of your own. Put an `icon` attribute in the event: an emoji, the address of an image, or a `data:image/` address. For plain JSON records, use `--icon VALUE` for all lanes, or `--icon-field NAME` for a field of the record. `--icon` also takes an image file. - streamview does not change the offsets of Kafka consumers, and it does not take messages from the queues of other services. - Source code: https://github.com/event-catalog/streamview --- # See your first events Kind: Tutorials. Address: https://www.eventcatalog.dev/tools/streamview/docs/tutorials/see-your-first-events Install streamview, start the demo, and find two faults in a mock order system. In this tutorial, you start streamview with a mock order system. You read the timeline, you open one event, and you find two faults. You need a terminal on macOS or Linux. You do not need a broker. On Windows, use Docker: see [Run streamview in Docker](/docs/how-to/run-in-docker/). ## 1. Install streamview Run this command: ``` curl -fsSL https://github.com/event-catalog/streamview/releases/latest/download/install.sh | sh ``` The command downloads the program and puts it in the directory `~/.local/bin`. The last lines tell you if that directory is not on your path, and what to do. To make sure that the program is there, run `streamview --version`. The terminal shows the version. ## 2. Start the demo Run this command: ``` streamview demo ``` The terminal shows this line: ``` streamview is live at http://localhost:4747 with a made-up order system (Ctrl-C to stop) ``` Your browser opens the page. You see twelve lanes, and new bars come in at the right side. ![The streamview page with twelve lanes. Each lane shows bars for the event rate.](../../../../assets/screens/overview.png) ## 3. Read the timeline Time goes from left to right. Each lane shows one channel, for example `orders.placed`. - The height of a bar shows the event rate. - The text below the channel name gives the broker, the rate, and the number of events in the view. - The lanes are in the sequence of the order flow. A cause is above its effect. The time range button at the top right has a clock icon. It shows the time range of the view. Click this button. Then click **Last 30 s**. The view now shows only the last 30 seconds. ## 4. Zoom in to single events 1. Drag across approximately three seconds of the timeline. 2. Look at the lanes. Each event is now one thin mark. The time range button shows the time range of the view. If you see bars and not marks, drag across a smaller range. ## 5. Open one event Click a mark in the `orders.placed` lane. A panel opens on the right side. The panel shows three things: - The type, the source, the time, and the ID of the event. - The trace: all events of the same order, with the time between them. - The full event as JSON. A blue line on the timeline connects the events of the order. ![The event panel on the right side. A blue line connects four events of one order across four lanes.](../../../../assets/screens/event.png) ## 6. Follow the order 1. Click `payments.authorized` in the trace. 2. Look at the panel. It now shows the payment event of the same order. You followed one order through two channels. Press Escape to close the panel. ## 7. Find the payment outage The demo makes a payment outage in each interval of ten minutes. 1. Click the time range button. Then click **All**. The view shows all events, approximately 15 minutes or more. 2. Find the `payments.failed` lane. It is red. 3. Find the time range where the red bars are high. In that time range, the `payments.captured` lane is empty. After the outage, `payments.captured` has high bars, because the held payments come through together. ## 8. Find the bad release The demo also makes a bad release in each interval of ten minutes. During the bad release, some `orders.placed` events send `total` as text and not as a number. 1. Find the amber bars in the `orders.placed` lane. 2. Press `/`. The search box opens a list. 3. Select `is`, and then select `violation`. The timeline now shows only the flagged events. 4. Zoom in to the amber marks, and click one mark. The panel shows the label **Shape drift**, and it shows the field that is different. 5. Press Backspace in the empty search box to remove the filter. ## What you did You started streamview, moved in time, opened an event, followed an order, and found two faults. Next steps: - [Watch a Kafka system](/docs/tutorials/watch-a-kafka-system/), with a real broker. - [Connect to Kafka](/docs/how-to/connect-to-kafka/), to see your own topics. - [The page](/docs/reference/the-page/), for all mouse and keyboard actions. --- # Send JSON records to streamview Kind: Tutorials. Address: https://www.eventcatalog.dev/tools/streamview/docs/tutorials/send-json-records Send an example file of plain JSON records from a command to streamview, find a payment outage, and make the view live. In this tutorial, you send the records of a mock order system to streamview. The records are plain JSON. They are not CloudEvents, and they do not come from a broker. You tell streamview which fields to use, you find a payment outage, and you make the view live. You need a terminal on macOS or Linux, with `curl`. You also need streamview. To install it, do step 1 of [See your first events](/docs/tutorials/see-your-first-events/). ## 1. Look at the example file The streamview website has an example file. Print its first three lines: ``` curl -s https://www.eventcatalog.dev/tools/streamview/examples/orders.jsonl | head -n 3 ``` The terminal shows three records, such as these: ``` {"name":"order.placed","at":"2026-12-03T08:15:22.200Z","orderId":"ord_1nex9rk","total":126.15,"currency":"GBP","country":"GB","items":2} {"name":"stock.reserved","at":"2026-12-03T08:15:22.371Z","orderId":"ord_1nex9rk","warehouse":"LHR-1"} {"name":"payment.authorized","at":"2026-12-03T08:15:22.936Z","orderId":"ord_1nex9rk","amount":126.15,"method":"card"} ``` Your records are different, because the website makes the file when you ask for it. The file has the records of the last 15 minutes, and its last record is from this moment. ## 2. Find the three fields streamview needs three facts about each record. Find them in the lines on your screen: | The fact | The field in this file | |---|---| | The kind of event | `name` | | The time of the event | `at` | | The ID that the records of one order share | `orderId` | ## 3. Send the file to streamview Run this command: ``` curl -s https://www.eventcatalog.dev/tools/streamview/examples/orders.jsonl | streamview serve - \ --db tutorial.db --type-field name --time-field at --correlation-field orderId --open ``` The `|` character sends the output of `curl` to streamview. The `-` tells streamview to read that output. The three options give the three fields from step 2. The terminal shows two lines, such as these: ``` streamview is live at http://localhost:4747 · send events to POST http://localhost:4747/events (Ctrl-C to stop) -: end of input, 1865 events accepted, 0 rejected ``` Your browser opens the page. ## 4. Show all events Click the time range button at the top right. It has a clock icon. Then click **All**. You see six lanes, one for each value of the `name` field. The view shows approximately 15 minutes. ![The streamview page with six lanes. Three lanes have a gap at the same time, and a high bar after the gap.](../../../../assets/screens/records.png) ## 5. Find the payment outage In the example system, the payment service stops for 80 seconds in each interval of 10 minutes. 1. Find the `payment.authorized` lane. 2. Find the gap in this lane. During the gap, the lane has no bars. 3. Look at the bar immediately after the gap. It is high, because the held payments come through together. 4. Look at the `order.shipped` lane and the `email.sent` lane. They have the same gap. 5. Look at the `order.placed` lane. It has no gap: customers continued to place orders. You found a fault from the shape of the timeline. You did not read one record. ## 6. Follow one order 1. Drag across approximately five seconds of the timeline. Each event is now one thin mark. 2. Click a mark in the `email.sent` lane. A panel opens on the right side. The trace in the panel shows five events: `order.placed`, `stock.reserved`, `payment.authorized`, `order.shipped`, and `email.sent`. A blue line on the timeline connects them. streamview connected these records because they have the same `orderId`. 3. Look at the JSON in the panel. The `data` field has the record as the file gave it. 4. Press Escape to close the panel. ## 7. Find the records that are different Some `order.placed` records give `total` as text and not as a number. streamview flags them. 1. Click the time range button. Then click **All**. 2. Find the amber bars in the `order.placed` lane. 3. Press `/`. The search box opens a list. 4. Select `is`, and then select `violation`. The timeline now shows only the flagged events. 5. Press Backspace in the empty search box to remove the filter. ## 8. Make the view live The command from step 3 read the file one time. Now read it again and again. 1. Go to the terminal. Press Ctrl-C to stop streamview. 2. Run this command: ``` while true; do curl -s https://www.eventcatalog.dev/tools/streamview/examples/orders.jsonl sleep 5 done | streamview serve - \ --db tutorial.db --type-field name --time-field at --correlation-field orderId --open ``` The command gets the file at intervals of 5 seconds. Each time, most records are the same as before. streamview keeps one copy of each record, and adds only the new records. 3. Go to the page that the browser opened. Look at the **Live** button. If its dot is not red, click the button. 4. Move the pointer off the timeline. New marks come in at the right side, in groups, at intervals of approximately 5 seconds. 5. To stop, go to the terminal and press Ctrl-C. ## 9. Remove the tutorial data streamview stored the events in the file `tutorial.db`, in the directory where you ran the command. Delete that file: ``` rm -f tutorial.db tutorial.db-shm tutorial.db-wal ``` ## What you did You sent plain JSON records from a command to streamview, and you gave the three fields. You found an outage, followed one order, found records that are different, and made the view live. The same steps work with your data, if a command can print it as JSON. Next steps: - [Show events from any command](/docs/how-to/show-events-from-any-command/), for a log file, a container, a database table, and an HTTP API. - [Show events from an S3 bucket](/docs/how-to/show-events-from-s3/), for an archive. - [Events from plain JSON records](/docs/reference/event-format/#events-from-plain-json-records), for the exact rules. --- # Watch a Kafka system Kind: Tutorials. Address: https://www.eventcatalog.dev/tools/streamview/docs/tutorials/watch-a-kafka-system Start an example order system on a real broker, follow one order across its topics, and start a fault. In this tutorial, you start a small order system that uses a real broker. The broker is Redpanda, which uses the Kafka protocol. You follow one order across its topics. Then you start a fault and see it on the timeline. You need Docker and Git. You do not need to install streamview or Node.js. ## 1. Start the example Get the streamview source code, and start the example: ``` git clone https://github.com/event-catalog/streamview cd streamview/example docker compose up -d --build ``` The first build takes some minutes. The command starts a broker, six services, and streamview. ## 2. Open the page Open `http://localhost:4747` in your browser. You see one lane for each topic, for example `orders.placed` and `payments.captured`. The six services send messages only through these topics. ## 3. Follow one order 1. Click the time range button at the top right. Then click **Last 30 s**. 2. Drag across approximately three seconds of the timeline. Each event is now one thin mark. 3. Click a mark in the `orders.placed` lane. The panel opens. The trace shows the events of this order in the other topics. The value next to each step is the time after the first event. The services send plain JSON messages, not CloudEvents. streamview connects the messages with the `orderId` field of each message. ## 4. Start a payment outage 1. Press Escape to close the panel. 2. Click **Live**. The view follows the current time again. 3. Run this command in a terminal: ``` curl -X POST 'localhost:18081/chaos/outage?seconds=60' ``` 4. Look at the `payments.authorized` lane and the `payments.captured` lane for two minutes. For 60 seconds, the payments service cannot get an answer from its payment gateway. The two lanes become empty, but `orders.placed` continues. When the outage ends, the two lanes show a burst, because the payments service handles the orders that waited. ## 5. Start a bad release 1. Run this command: ``` curl -X POST 'localhost:18080/chaos/bad-deploy?seconds=45' ``` 2. Look at the `orders.placed` lane. For 45 seconds, the orders service sends `total` as text. streamview shows these events in amber, because their shape is different from the usual shape. 3. Click an amber mark. The panel shows the label **Shape drift** and the field that is different. ## 6. Stop the example Run this command in the `example` directory: ``` docker compose down -v ``` The command stops the containers and deletes their data. ## What you did You saw a real Kafka system on the timeline, followed one order, and saw two faults when they occurred. Next steps: - [Connect to Kafka](/docs/how-to/connect-to-kafka/), to see your own topics. - [How streamview reads without taking messages](/docs/explanation/how-streamview-reads/). --- # Watch a NATS system Kind: Tutorials. Address: https://www.eventcatalog.dev/tools/streamview/docs/tutorials/watch-a-nats-system Start an example food-delivery system on a real NATS server with JetStream, and follow one order. In this tutorial, you start a small food-delivery system that uses a real NATS server with JetStream. You see subjects with history and subjects without history. Then you follow one order. You need Docker and Git. You do not need to install streamview or Node.js. ## 1. Start the example Get the streamview source code, and start the example: ``` git clone https://github.com/event-catalog/streamview cd streamview/example-nats docker compose up -d --build ``` The first build takes some minutes. The command starts a NATS server, four services, and streamview. ## 2. Open the page Open `http://localhost:4748` in your browser. You see one lane for each subject, for example `orders.created` and `kitchen.accepted`. ## 3. Compare two kinds of subject Click the time range button at the top right. Then click **All**. The view shows all events that streamview has. - `orders.created` has events from the time when the example started. A JetStream stream stores this subject. - `search.performed` has events only from the time when streamview started. NATS does not store this subject. streamview reads a stored subject from the first message of its stream. For the other subjects, it sees only the new messages. ## 4. See how streamview makes one lane from many subjects Find the `telemetry.courier` lane. Each courier sends to its own subject, for example `telemetry.courier.7`. The example starts streamview with `--depth 2`. Thus all courier subjects are one lane. ## 5. Follow one order 1. Click the time range button. Then click **Last 30 s**. 2. Drag across approximately five seconds of the timeline. Each event is now one thin mark. 3. Click a mark in the `orders.created` lane. The panel opens. The trace shows the steps of the order, for example `kitchen.accepted` and `delivery.assigned`. An order takes some time, thus the last steps arrive later. 4. Wait some seconds. Then press Escape, and click the mark again. The trace now shows more steps. ## 6. Find the bad release The example makes a bad release automatically, at intervals of some minutes. During the bad release, the courier service sends `distanceKm` as text. 1. Click the time range button. Then click **All**. 2. Press `/`, select `is`, and then select `violation`. If the bad release occurred, the `delivery.completed` lane shows amber events. If the timeline is empty, wait some minutes and look again. 3. Press Backspace in the empty search box to remove the filter. ## 7. Stop the example Run this command in the `example-nats` directory: ``` docker compose down -v ``` The command stops the containers and deletes their data. ## What you did You saw a real NATS system on the timeline, with stored subjects and subjects that NATS does not store. Next steps: - [Connect to NATS](/docs/how-to/connect-to-nats/), to see your own subjects. - [How streamview reads without taking messages](/docs/explanation/how-streamview-reads/). --- # Watch a RabbitMQ system Kind: Tutorials. Address: https://www.eventcatalog.dev/tools/streamview/docs/tutorials/watch-a-rabbitmq-system Start a small bike-rental system on a real RabbitMQ server, follow one booking, and see the messages that go directly to a queue. In this tutorial, you start a small bike-rental system that uses a real RabbitMQ server. You follow one booking across three exchanges. Then you turn on the tracer to see more messages. You need Docker and Git. You do not need to install streamview or Node.js. ## 1. Start the example Get the streamview source code, and start the example: ``` git clone https://github.com/event-catalog/streamview cd streamview/example-rabbitmq docker compose up -d --build ``` The first build takes some minutes. The command starts a RabbitMQ server, four services, and streamview. ## 2. Open the page Open `http://localhost:4749`. After some seconds, you see eight lanes. Each lane is one routing key on one exchange. The text below the name of a lane does not show the exchange. Move the pointer over the name to see it. | Lane | Exchange | Kind of exchange | |---|---|---| | `booking.requested`, `booking.confirmed`, `booking.rejected` | `events` | Topic | | `payment.charged`, `payment.declined`, `email.sent` | `events` | Topic | | `charge` | `payments` | Direct | | `audit` | `audit` | Fanout | You see only new messages. RabbitMQ does not keep old messages for a new queue. ## 3. Follow one booking 1. Click the time range button at the top right. Then click **Last 30 s**. 2. Move the pointer onto the timeline. The button shows **Live · paused**, and the view does not move. 3. Drag across approximately 5 seconds of the timeline. You now see thin marks. 4. Click a mark in the `booking.requested` lane. A panel opens. The trace shows the events of this booking: `booking.requested`, `audit`, `charge`, `payment.charged`, `booking.confirmed`, and `email.sent`. A blue line on the timeline connects them. The services send plain JSON. streamview connects the messages because all of them have the field `bookingId`. ## 4. Make sure that streamview takes no messages 1. Open `http://localhost:15673`. This is the management page of RabbitMQ. 2. Type `streamview` as the user name and as the password. 3. Click **Queues and Streams**. You see the six queues of the services, and one queue with a name that starts with `amq.gen-`. That queue is the queue of streamview. The queues of the services have no messages that wait. ## 5. See the messages that go directly to a queue The trace has a step that is not there. The `bookings` service sends a message directly to the queue `email.send`. This message does not go through one of the three exchanges, thus streamview does not see it. The tracer of RabbitMQ gives a copy of each published message. Turn it on: ``` docker compose exec rabbitmq rabbitmqctl trace_on ``` Then start streamview again with `--trace`: ``` docker compose run --rm -d -p 127.0.0.1:4750:4747 streamview \ rabbitmq --url amqp://streamview:streamview@rabbitmq:5672 --correlation-field bookingId --trace ``` Open `http://localhost:4750`. After some seconds, you see a ninth lane, `email.send`. Open a `booking.requested` event again. The trace now has the step `email.send` before `email.sent`. ## 6. Stop the example ``` docker compose down -v --remove-orphans ``` The command stops the containers and deletes the data. ## What you did - You started a system with a topic exchange, a direct exchange, and a fanout exchange. - You followed one booking across the three exchanges. - You saw that streamview uses a queue of its own. - You used the tracer to see a message that goes directly to a queue. To connect streamview to your own server, see [Connect to RabbitMQ](/docs/how-to/connect-to-rabbitmq/). --- # Install streamview Kind: How-to guides. Address: https://www.eventcatalog.dev/tools/streamview/docs/how-to/install-streamview Install the streamview program on macOS or Linux with one command, or use the container image. You can use streamview in two ways: as a program on your computer, or as a container. ## Install the program on macOS or Linux Run this command in a terminal: ``` curl -fsSL https://github.com/event-catalog/streamview/releases/latest/download/install.sh | sh ``` The command downloads the program for your computer and checks the download. It puts the program `streamview` in the directory `~/.local/bin`. If that directory is not on your path, the command tells you. It shows the line to add to the configuration file of your shell. To make sure that the program works, run `streamview demo`. The program contains the server, the page, the fonts, and the adapters for Kafka, NATS, and RabbitMQ. For `streamview kafka`, `streamview nats`, and `streamview rabbitmq`, you also need Node.js. We tested version 24. ## Select the version or the directory Set a variable before `sh`: | Variable | Default | What it does | |---|---|---| | `STREAMVIEW_VERSION` | The latest release | Gives the version to install, for example `0.1.0`. | | `STREAMVIEW_INSTALL_DIR` | `~/.local/bin` | Gives the directory for the program. | For example: ``` curl -fsSL https://github.com/event-catalog/streamview/releases/latest/download/install.sh | STREAMVIEW_VERSION=0.1.0 sh ``` ## Use Windows, or do not install a program Use the container image. You need only Docker. ``` docker run --rm -p 127.0.0.1:4747:4747 ghcr.io/event-catalog/streamview ``` See [Run streamview in Docker](/docs/how-to/run-in-docker/). ## Get a newer version Run this command: ``` streamview update ``` The command downloads the latest version and replaces the program. If you use the container, run `docker pull ghcr.io/event-catalog/streamview`. When streamview starts, it tells you if there is a newer version. It prints one line in the terminal. For this, streamview asks GitHub for the number of the latest version, one time each day. It does not send data about you or your events. To stop this check, set the variable `STREAMVIEW_NO_UPDATE_CHECK` to `1`. To see the version that you have, run `streamview --version`. Version 0.1.0 has no `update` command. If you have that version, run the install command again. ## Remove streamview Delete the file `~/.local/bin/streamview`. The adapters are in the directory `~/.cache/streamview`. Delete that directory too. ## Related - [Build streamview from the source code](/docs/how-to/build-from-source/) - [Command line](/docs/reference/command-line/) --- # Connect to Kafka Kind: How-to guides. Address: https://www.eventcatalog.dev/tools/streamview/docs/how-to/connect-to-kafka Show the messages of your Kafka topics on the timeline, and select the topics that streamview reads. You need the `streamview` program, Node.js, and the address of a broker. ## Show all topics Run this command with the address of your broker: ``` streamview kafka --brokers localhost:9092 ``` The first time, the command installs the Kafka adapter. This takes some seconds. The browser then opens, and each topic is one lane. streamview reads all stored messages first, and sorts them by time. With many messages, this takes some minutes. The page stays empty during this time. ## Connect to a broker that needs TLS or a login A hosted Kafka service usually needs an encrypted connection (TLS) and a login (SASL). Your Kafka service gives you the address, the user name, the password, and the login mechanism. 1. Put the password in the environment variable `STREAMVIEW_KAFKA_PASSWORD`. For some services, the password is an API secret. 2. Add `--tls` to the command. 3. Add `--user` with the user name. For some services, the user name is an API key. 4. Add `--mechanism` if the service does not use `plain`. The other mechanisms are `scram-sha-256` and `scram-sha-512`. ``` export STREAMVIEW_KAFKA_PASSWORD='your-password' streamview kafka --brokers broker.example.com:9093 --tls --user your-user --mechanism scram-sha-512 ``` If the broker has a certificate from a private certificate authority, add `--ca` with the PEM file of that authority. `--ca` also turns on TLS. ``` streamview kafka --brokers broker.example.com:9093 --ca ca.pem --user your-user ``` If the broker asks for a client certificate, add `--cert` and `--key` with the two PEM files. ``` streamview kafka --brokers broker.example.com:9093 --ca ca.pem --cert client.pem --key client-key.pem ``` If the broker refuses the connection, the command prints the cause in the terminal, and tells you which option to change. :::note We tested these options with a Redpanda broker. We did not test them with a hosted Kafka service. The Kafka adapter does not have the IAM login of Amazon MSK, and it does not have OAuth. ::: ## Show only new messages Add `--latest`. streamview then does not read the stored messages. ``` streamview kafka --brokers localhost:9092 --latest ``` ## Show only some topics Add `--topics` with a regular expression. streamview reads only the topics that match. ``` streamview kafka --brokers localhost:9092 --topics '^(orders|payments)\.' ``` streamview does not read internal topics, for example `__consumer_offsets`, also when the expression matches them. To read them, add `--include-internal`. ## Connect the messages of one order If your messages are CloudEvents, streamview uses their `correlationid` field. If your messages are plain JSON, streamview looks for a `correlationid` header or a `traceparent` header. If the messages do not have these headers, use one of these two options: - Add `--correlation-field` with the name of the field that all messages of one order contain. - Add `--correlation-key` if the key of each message is the ID of the order. ``` streamview kafka --brokers localhost:9092 --correlation-field orderId ``` ``` streamview kafka --brokers localhost:9092 --correlation-key ``` Do not use `--correlation-key` if many different orders have the same key. All messages with one key then become one order. ## Continue from the last position By default, streamview uses a new consumer group for each start, and reads all stored messages. To continue from the position of the last start, give the consumer group a name with `--group`. Use the same SQLite file each time, because the file has the events from before. ``` streamview kafka --brokers localhost:9092 --group streamview-team ``` When a group with this name read before, the command prints a line that tells you. If the page is empty and you expected old messages, use a different name, or remove `--group`. ## Keep the events in a different file streamview stores the events in `streamview.db` in the current directory. To use a different file, add `--db` and a path. ``` streamview kafka --brokers localhost:9092 --db /var/lib/streamview/kafka.db ``` When you start streamview again with the same file, it loads the stored events and ignores messages that it already has. ## Use more than one broker Put a comma between the addresses: ``` streamview kafka --brokers broker-1:9092,broker-2:9092 ``` ## Related - [Command line: `streamview kafka`](/docs/reference/command-line/#streamview-kafka) - [How streamview reads without taking messages](/docs/explanation/how-streamview-reads/) - [Limit how long streamview keeps events](/docs/how-to/limit-kept-events/) --- # Connect to NATS Kind: How-to guides. Address: https://www.eventcatalog.dev/tools/streamview/docs/how-to/connect-to-nats Show the messages of your NATS subjects and JetStream streams on the timeline. You need the `streamview` program, Node.js, and the address of a NATS server. :::caution The NATS adapter has no TLS options. ::: ## Show all subjects Run this command with the address of your server: ``` streamview nats --servers localhost:4222 ``` The first time, the command installs the NATS adapter. This takes some seconds. The browser then opens, and each subject is one lane. - For subjects that a JetStream stream stores, you see the history. - For all other subjects, you see only the messages that come after streamview starts. ## Show only some subjects Add `--subjects`, with a comma between the subjects. You can use the `*` and `>` wildcards. ``` streamview nats --servers localhost:4222 --subjects 'orders.>,payments.*' ``` ## Make one lane from subjects that contain IDs If your subjects contain IDs, there are too many lanes. Add `--depth` with the number of subject parts that make one lane. ``` streamview nats --servers localhost:4222 --depth 2 ``` With `--depth 2`, `telemetry.courier.7` and `telemetry.courier.8` are one lane, `telemetry.courier`. The full subject stays in the `subject` field of each event. ## Show only new messages from streams Add `--latest`. streamview then does not read the history of the streams. To ignore JetStream fully, add `--no-jetstream`. streamview then subscribes to all subjects. ## Connect the messages of one order Add `--correlation-field` with the name of the field that all messages of one order contain. ``` streamview nats --servers localhost:4222 --correlation-field orderId ``` streamview also reads the `correlationid` header, the `Correlation-Id` header, and the `traceparent` header of a message. ## Give a name and a password Use one of these three options: | The server needs | Add | |---|---| | A name and a password | `--user NAME --password TEXT` | | A token | `--token TEXT` | | A credentials file | `--creds FILE` | :::note We did not test these three options against a server that has authentication. ::: ## Related - [Command line: `streamview nats`](/docs/reference/command-line/#streamview-nats) - [How streamview reads without taking messages](/docs/explanation/how-streamview-reads/) --- # Connect to RabbitMQ Kind: How-to guides. Address: https://www.eventcatalog.dev/tools/streamview/docs/how-to/connect-to-rabbitmq Show the messages of your RabbitMQ exchanges on the timeline, and do not take a message from your services. You need the `streamview` program, Node.js, and the address of a RabbitMQ server. streamview does not read the queues of your services. It makes a temporary queue of its own. Thus your services continue to get all their messages. See [How streamview reads without taking messages](/docs/explanation/how-streamview-reads/#rabbitmq). :::note RabbitMQ does not keep old messages for a new queue. You see only the messages that come after streamview starts. ::: ## Show all exchanges Run this command with the address, the user, and the password of your server: ``` streamview rabbitmq --url amqp://user:password@localhost:5672 ``` The first time, the command installs the RabbitMQ adapter. This takes some seconds. The browser then opens. Each routing key on each exchange is one lane. To find the exchanges, streamview uses the management API of RabbitMQ on port 15672. It uses the user and the password from `--url`. It does not read the exchanges of RabbitMQ itself, which have names that start with `amq.`. ## Use a virtual host or TLS Put the virtual host at the end of the address: ``` streamview rabbitmq --url amqp://user:password@localhost:5672/my-vhost ``` For a connection with TLS, start the address with `amqps://`: ``` streamview rabbitmq --url amqps://user:password@broker.example.com:5671 ``` ## Show only some exchanges Add `--exchanges` with the names, and a comma between them: ``` streamview rabbitmq --url amqp://user:password@localhost:5672 --exchanges orders,payments ``` ## Connect if the management API is not available If the management API has a different address, give it with `--management`: ``` streamview rabbitmq --url amqp://user:password@localhost:5672 --management http://localhost:8080 ``` If there is no management API, do these two steps: 1. Add `--no-management`. 2. Add `--exchanges` with the names of the exchanges. For a direct exchange, also add `--routing-keys` with the routing keys that you want to see. Without the management API, streamview cannot find them. ``` streamview rabbitmq --url amqp://user:password@localhost:5672 --no-management \ --exchanges orders,payments --routing-keys charge,refund ``` ## See the messages that go directly to a queue A program can send a message directly to a queue. RabbitMQ calls this the default exchange. streamview cannot connect its queue to the default exchange, thus it does not see these messages. To see them, use the tracer of RabbitMQ: 1. On the RabbitMQ server, run `rabbitmqctl trace_on`. 2. Start streamview with `--trace`. ``` streamview rabbitmq --url amqp://user:password@localhost:5672 --trace ``` streamview then gets a copy of each message that a program publishes, on all exchanges. :::caution The tracer makes the RabbitMQ server slower. Do not keep it on in a busy production system. To stop it, run `rabbitmqctl trace_off`. ::: ## Connect the messages of one order If your messages are CloudEvents, streamview uses their `correlationid` field. If your messages are plain JSON, streamview uses the `correlation_id` property of the message. If your programs do not set this property, add `--correlation-field` with the name of the field that all messages of one order contain. ``` streamview rabbitmq --url amqp://user:password@localhost:5672 --correlation-field orderId ``` ## Decrease the number of lanes Each routing key becomes one lane. If your routing keys contain IDs or regions, there are too many lanes. Use `--depth` to make a lane from only the first parts of the routing key. ``` streamview rabbitmq --url amqp://user:password@localhost:5672 --depth 2 ``` With `--depth 2`, `order.created.eu` and `order.created.us` are one lane. ## Related - [Command line: `streamview rabbitmq`](/docs/reference/command-line/#streamview-rabbitmq) - [Watch a RabbitMQ system](/docs/tutorials/watch-a-rabbitmq-system/) - [Event format: events from RabbitMQ messages](/docs/reference/event-format/#events-from-rabbitmq-messages) --- # Show events from a file, a program, or HTTP Kind: How-to guides. Address: https://www.eventcatalog.dev/tools/streamview/docs/how-to/show-your-own-events Send CloudEvents to streamview from a file, from the output of a different program, or with an HTTP request. Use `streamview serve` when your events do not come from Kafka, NATS, or RabbitMQ. Each line of the input is one JSON object: a CloudEvent, or a plain JSON record. A CloudEvent has the fields `id`, `source`, and `type`. See [Event format](/docs/reference/event-format/) for all fields. streamview makes an event from a plain JSON record. See [Show plain JSON records](#show-plain-json-records). ## Send events from a file 1. Put one event on each line of a file, for example `events.jsonl`. 2. Run this command: ``` streamview serve events.jsonl --open ``` ## Send events from a different program Use `-` as the file name. streamview then reads from standard input. ``` my-program | streamview serve - --open ``` The program must print one event on each line. See [Show events from any command](/docs/how-to/show-events-from-any-command/) for a log file, a container, a database table, and an HTTP API. ## Send events with HTTP 1. Run `streamview serve --open`. 2. Send a `POST` request to `http://localhost:4747/events`. The body of the request can be one event, a JSON array of events, or one event on each line. ``` curl -X POST http://localhost:4747/events \ -d '{"specversion":"1.0","id":"1","source":"/shop","type":"order.placed","data":{"country":"GB"}}' ``` The answer gives the number of events that streamview accepted and rejected: ``` {"accepted":1,"rejected":0} ``` ## Show plain JSON records A plain JSON record is a JSON object that is not a CloudEvent, for example a line of a log or of an archive. Tell streamview which fields of the record to use: ``` streamview serve records.jsonl --type-field eventType --time-field occurredAt --correlation-field orderId --open ``` | Option | The field that it gives | |---|---| | `--type-field` | The kind of event. Each kind is one lane. | | `--time-field` | The time of the event. | | `--correlation-field` | The ID that connects the events of one order. | - Use a period to go into an object, as in `metadata.timestamp`. - Use `--type TEXT` to give one type to all records. - The file can be a gzip file. - If the records are not in time sequence, add `--sort`. The page then shows the events when streamview reaches the end of the file. The same options apply to the records that you send to `POST /events`. ## Keep the events in a different file streamview stores each event in a SQLite file. The default file is `streamview.db` in the current directory. To use a different file, add `--db` and a path. When you start the server again with the same file, it loads the stored events. Open pages connect again automatically. ## Related - [Show events from any command](/docs/how-to/show-events-from-any-command/) - [Show events from an S3 bucket](/docs/how-to/show-events-from-s3/) - [Show webhooks](/docs/how-to/show-webhooks/) - [Event format](/docs/reference/event-format/) - [HTTP endpoints](/docs/reference/http-endpoints/) - [Make test events](/docs/how-to/make-test-events/) --- # Show webhooks Kind: How-to guides. Address: https://www.eventcatalog.dev/tools/streamview/docs/how-to/show-webhooks Give a service an address on streamview, and see each webhook that it sends as an event on the timeline. A webhook is an HTTP request that a service sends to you when something occurs. streamview makes one event from each webhook. It does not need CloudEvents, an adapter, or Node.js. streamview does not check the signature of a webhook. It shows each request that arrives. ## Start streamview Run this command: ``` streamview webhooks ``` The browser opens. The page is empty until the first webhook arrives. ## Send a test webhook 1. Run this command in a different terminal: ``` curl -X POST http://localhost:4747/webhooks/shop \ -H 'Content-Type: application/json' \ -d '{"event":"order.paid","orderId":"ord_1","total":42}' ``` 2. Read the answer: ``` {"accepted":true,"type":"shop.order.paid","id":"wh-1a23ad82ed3-0"} ``` 3. Look at the page. After approximately 2 seconds, the event shows in the lane `shop.order.paid`. ## Give each service an address The address of a webhook is `/webhooks/NAME`. You select the name. Use one name for each service, for example `/webhooks/stripe` and `/webhooks/github`. The name can have letters, digits, and the characters `.`, `_`, and `-`. The name is the start of the event type, and it is the `channel` of the event. streamview finds the kind of the event in the headers or in the body of the webhook. Each kind gets a lane of its own, for example `stripe.payment_intent.succeeded` and `stripe.charge.refunded`. See [Events from webhooks](/docs/reference/event-format/#events-from-webhooks) for the places where streamview looks. ## Receive webhooks from a service on the internet A service on the internet cannot connect to `localhost`. A tunnel gives your computer a public address. These steps use `cloudflared`, the tunnel program of Cloudflare. Other tunnel programs work the same way. :::caution The public address shows the streamview page also. Each person who has the address can read your events and send events. Stop the tunnel when you do not use it. ::: 1. Start streamview: `streamview webhooks`. 2. Run this command in a different terminal: ``` cloudflared tunnel --url http://localhost:4747 ``` 3. Find the address in the output. It ends with `trycloudflare.com`. 4. In the settings of the service, give this webhook address: the public address, then `/webhooks/`, then your name. For example: `https://example-words.trycloudflare.com/webhooks/stripe`. The public address can need some seconds before it works. If the server runs on a computer that the service can connect to, you do not need a tunnel. Start streamview with `--host 0.0.0.0`. See [Share a view](/docs/how-to/share-a-view/). ## Give a webhook an icon Add `icon` to the address that you give to the service. An emoji is the simplest icon: ``` http://localhost:4747/webhooks/stripe?icon=💳 ``` The value can also be the address of an image. See [The icon of a lane](/docs/reference/event-format/#the-icon-of-a-lane). ## Set the type yourself If a service does not say what kind of event it sends, the type is only the name. To give the type, add `?type=` to the address: ``` https://example-words.trycloudflare.com/webhooks/builds?type=build.finished ``` All webhooks to this address then have the type `build.finished`. ## Connect the webhooks of one order streamview connects events that have the same correlation ID. Tell it which field of the body has the ID. For all addresses, start streamview with `--correlation-field`: ``` streamview webhooks --correlation-field orderId ``` For one address, add `?correlation-field=` to the address: ``` http://localhost:4747/webhooks/stripe?correlation-field=data.object.metadata.order_id ``` - Use a period to go into an object, as in `data.object.metadata.order_id`. - Use a comma between two or more fields. streamview uses the first field that the body has. When two services send the same ID, the trace shows their webhooks together. ## Show webhooks and a broker together Each streamview server that stores events accepts webhooks: `kafka`, `nats`, `rabbitmq`, `serve`, and `demo`. Send the webhooks to the same port. Their lanes show below the lanes of the broker. ## Related - [Events from webhooks](/docs/reference/event-format/#events-from-webhooks) - [HTTP endpoints](/docs/reference/http-endpoints/) - [Follow one order](/docs/how-to/follow-one-order/) --- # Show events from any command Kind: How-to guides. Address: https://www.eventcatalog.dev/tools/streamview/docs/how-to/show-events-from-any-command Send the output of a command to streamview. If the command prints JSON objects, streamview shows them as events. `streamview serve -` reads the output of a different command. If the command prints JSON objects, streamview shows each object as an event. Thus you can show a log file, the logs of a container, a database table, or the answer of an HTTP API. The objects do not have to be CloudEvents. You tell streamview which fields to use. Some steps on this page use `jq`, a program that changes JSON. If this is new to you, do the tutorial [Send JSON records to streamview](/docs/tutorials/send-json-records/) first. ## Find the three fields 1. Print one record of your data. 2. Find the field that gives the kind of event, for example `event`. This is the value of `--type-field`. 3. Find the field that gives the time, for example `ts`. This is the value of `--time-field`. 4. Find the field that the events of one order share, for example `orderId`. This is the value of `--correlation-field`. Only the first of the three is important for a live view. Each kind of event gets a lane of its own. - If the field is in an object, use a period: `payload.orderId`. - If no field gives the kind of event, use `--type TEXT`. Then all records are in one lane. - If no field gives the time, streamview uses the time when it read the record. streamview knows some usual field names. If your records use them, you do not need the options. See [Events from plain JSON records](/docs/reference/event-format/#events-from-plain-json-records). ## Follow a log file Use this when a program writes one JSON object on each line of a file. ``` tail -n +1 -f app.log | streamview serve - \ --type-field event --time-field ts --correlation-field orderId --open ``` `tail -n +1 -f` prints the full file, and then each new line. The page shows each new event approximately 2 seconds after the program writes it. ## Follow the logs of a container ``` docker logs -f my-container 2>&1 | streamview serve - \ --type-field event --correlation-field orderId --open ``` `docker logs -f` prints the old lines, and then each new line. `2>&1` also sends the lines that the container writes to standard error. streamview rejects a line that is not a JSON object. The other lines continue to show. ## Load the rows of a database table This example reads an outbox table from PostgreSQL. Each row becomes one record. ``` psql "postgres://USER:PASSWORD@HOST:5432/DATABASE" -At \ -c "select row_to_json(o) from outbox o order by created_at" \ | streamview serve - --db outbox.db \ --type-field event_type --time-field created_at --correlation-field payload.orderId --open ``` - `row_to_json` makes one JSON object from each row. - `-At` prints only the rows, with no table lines. - `order by created_at` gives the rows in time sequence. When the command reaches the last row, the terminal shows a line such as this: ``` -: end of input, 300 events accepted, 0 rejected ``` ## Load the answer of an HTTP API Many APIs give a JSON array. `jq` prints each item of the array on a line of its own. This example shows the public events of GitHub: ``` curl -s https://api.github.com/events | jq -c 'sort_by(.created_at)[]' \ | streamview serve - --db github.db \ --type-field type --time-field created_at --correlation-field repo.name --open ``` `sort_by(.created_at)` puts the items in time sequence. This API gives the newest item first. To get new items continuously, run the request in a loop: ``` while true; do curl -s https://api.github.com/events | jq -c 'sort_by(.created_at)[]' sleep 60 done | streamview serve - --db github.db \ --type-field type --time-field created_at --correlation-field repo.name --open ``` The API gives many of the same items each time. streamview keeps one copy of a record that has a time and the same text. ## Take the records out of a larger object Some files have all records in one JSON object. An AWS CloudTrail file is an example: its records are in the `Records` field. ``` jq -c '.Records[]' trail.json | streamview serve - --db trail.db \ --type-field eventName --time-field eventTime --sort --open ``` ## Change a text log to JSON If a log is text, `jq` can make a JSON object from each line. This example reads lines such as `2026-12-01T10:00:00Z INFO order.placed ord_1`: ``` jq -Rc 'capture("^(?