# Run Snowplow Micro locally
> Run Snowplow Micro locally using Docker to validate and debug tracking implementations. Send events to port 9090 and view results through the dashboard, API, or exported TSV/JSON format.
> Source: https://docs.snowplow.io/docs/testing/snowplow-micro/local/
> Documentation index: https://docs.snowplow.io/llms.txt

> **Tip: Micro in Console**
>
> For general use, we recommend [running Micro through Snowplow Console](/docs/testing/snowplow-micro/console/). However, running locally can be useful if you don’t have access to Console or need an advanced configuration.

The easiest way to run Micro locally is through [Docker](https://www.docker.com/).

[Docker Hub: snowplow/snowplow-micro](https://hub.docker.com/r/snowplow/snowplow-micro)

Run the following command:

```bash
docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2
```

You should see output like this:

```text
[INFO] com.snowplowanalytics.snowplow.micro.Run - No enrichments enabled
[INFO] com.snowplowanalytics.snowplow.micro.MicroHttpServer - Building blaze server
[INFO] org.http4s.blaze.channel.nio1.NIO1SocketServerGroup - Service bound to address /[0:0:0:0:0:0:0:0]:9090
```

**A note on ports...**

The command above will route port `9090` on your machine to Micro. If that port is already taken, you will want to change it, like so:

```bash
docker run -p 5000:9090 snowplow/snowplow-micro:4.6.2
            ↑↑↑↑
```

Note that Micro will still log `REST interface bound to /0.0.0.0:9090` — `9090` here refers to the port _inside_ the container.

We will use `9090` in the examples below, but remember to substitute the port of your choosing.

> **Tip:** We also provide a _distroless_ image of Micro. Because it only includes the bare minimum, it’s smaller and more secure. However, the downside of using the distroless image is that basic utilities (such as a shell) are not available.
>
> To use this image, add `-distroless` to the tag:
>
> ```bash
> docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2-distroless
> ```

If Docker is not available on your system, you can also run Micro as a Java application (since version 2.3.1). The `jar` files are availble via [GitHub releases](https://github.com/snowplow/snowplow-micro/releases).

```bash
java -jar micro-4.6.2.jar
```

Most of the examples on this and the following pages will show the Docker option, but feel free to adapt them accordingly.

## Sending events to Micro

Follow the documentation for one of [our trackers](/docs/sources/) to implement some tracking code on your website or application.

You can then point it to `localhost:9090` where Micro is listening. For example, using the [Browser tracker](/docs/sources/web-trackers/):

```js
import { newTracker, trackPageView, enableActivityTracking } from '@snowplow/browser-tracker';

newTracker('snowplow', 'localhost:9090', {
  appId: 'my-app-id',
  plugins: [],
});

trackPageView();
enableActivityTracking({
  heartbeatDelay: 10,
  minimumVisitLength: 10,
});
```

## Checking the results

Once you have the tracking code and the events are flowing in, you should see something like this in the Micro logs:

```text
[INFO] EventLog - GOOD id:4bfd5b32-d02a-4f83-a731-4339898437e1 app_id:test type:page_view (iglu:com.snowplowanalytics.snowplow/page_view/jsonschema/1-0-0)
[INFO] EventLog - GOOD id:e7a5c64d-d0f7-48d9-9a50-be044db7d2f6 app_id:test type:page_ping (iglu:com.snowplowanalytics.snowplow/page_ping/jsonschema/1-0-0)
[INFO] EventLog - GOOD id:1608ca85-f5f9-4948-898a-728aa8f1131b app_id:test type:page_ping (iglu:com.snowplowanalytics.snowplow/page_ping/jsonschema/1-0-0)
```

This means your tracking is set up correctly and your events are valid (`GOOD`).

Would you rather see the events visually? Open <http://localhost:9090/micro/ui> in your browser. You might want to check [a few tips on how to use the dashboard](/docs/testing/snowplow-micro/ui/).

![Snowplow Micro dashboard at localhost:9090/micro/ui showing a bar chart of event volume over time and a table of 81 events. All visible rows show Valid status, with event names including page\_ping, ping\_event, and pause\_event collected from a YouTube example page.](/assets/images/overview-1728998b503b68a664fe3b2d8c0e36b8.png)

Alternatively, you can inspect the events via [the API](/docs/api-reference/snowplow-micro/api/). For example, try:

```bash
curl localhost:9090/micro/good
```

## Exporting events

Snowplow pipelines output data in the [_enriched TSV format_](/docs/destinations/custom-streaming/enriched-tsv-format/). Typically, this is picked up by one of our [loaders](/docs/destinations/warehouses-lakes/) or by tools such as [Snowbridge](/docs/api-reference/snowbridge/).

With Micro, you can see what your data would look like in this format — useful if you want to test any logic that is parsing this data.

```bash
docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2 --output-tsv
```

Since version 2.4.0, you can alternatively output the data in JSON format (the same as provided in [Snowplow Analytics SDKs](/docs/api-reference/analytics-sdk/)):

```bash
docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2 --output-json
```

Also since version 2.4.0 you can send the data in either format to an HTTP endpoint, rather then standard output:

```bash
docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2 --output-tsv \
--destination http://some-url.com
```

**Output vs logs**

The TSV or JSON data will be printed to the [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_\(stdout\)). As you saw above, Micro also prints logs, which go into the [standard error stream](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_\(stderr\)).

Depending on how you are running Micro, you might find the logs distracting. If so, you can turn off event logs with an extra option:

```bash
docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2 --output-tsv \
-Dorg.slf4j.simpleLogger.log.EventLog=off
```

Or just discard the standard error stream entirely using the syntax appropriate for your shell:

```bash
# for bash
docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2 --output-tsv \
2>/dev/null
```

Finally, you can save the output to a file:

```bash
docker run -p 9090:9090 snowplow/snowplow-micro:4.6.2 --output-tsv > output.tsv
```
