# Running OpenTelemetry as a CLI application

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fopentelemetry%2Fintegrations%2Frunning-opentelemetry-as-a-cli-application.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fopentelemetry%2Fintegrations%2Frunning-opentelemetry-as-a-cli-application.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

This tutorial demonstrates how to configure [OpenTelemetry](https://coralogix.com/docs/docs/opentelemetry/getting-started/.md) (OTEL) Collector to send your logs and metrics to Coralogix when running OpenTelemetry as a CLI application or service.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

* OpenTelemetry CLI application or service installed

**Notes**:

To use the Coralogix Exporter, ensure that you have installed [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib). You can download the relevant version for your OS using this [link](https://github.com/open-telemetry/opentelemetry-collector-releases/releases/).

## Configuration[​](#configuration "Direct link to Configuration")

**STEP 1**. Create a configuration file. Copy this template file and save it as `config.yaml`.

```
receivers:

  filelog:

    start_at: beginning

    include:

      - /example.log

    include_file_path: true

    multiline: {line_start_pattern: "\\n"}

  hostmetrics:

    collection_interval: 30s

    scrapers:

      cpu:

      memory:

exporters:

  coralogix:

    domain: "Domain"

    private_key: "Private key"

    application_name: "Application Name"

    subsystem_name: "Subsystem Name"

    timeout: 30s



service:

  pipelines:

    logs:

      receivers: [ filelog ]

      exporters: [ coralogix ]

    metrics:

      receivers: [ hostmetrics ]

      exporters: [ coralogix ]
```

Provide the following variables.

| Variable         | Description                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Private Key      | Your Coralogix **[Send-Your-Data API key](https://coralogix.com/docs/docs/user-guides/account-management/api-keys/send-your-data-api-key/.md)**                                                                                                                                                                                                                                                          |
| Application Name | The name of your **[application](https://coralogix.com/docs/docs/user-guides/account-management/account-settings/application-and-subsystem-names/.md)**, as it will appear in your Coralogix dashboard. For example, a company named SuperData might insert the SuperData string parameter. If SuperData wants to debug its test environment, it might use SuperData–Test.                               |
| Subsystem Name   | The name of your **[subsystem](https://coralogix.com/docs/docs/user-guides/account-management/account-settings/application-and-subsystem-names/.md)**, as it will appear in your Coralogix dashboard. Applications often have multiple subsystems (ie. Backend Servers, Middleware, Frontend Servers, etc.). In order to help you examine the data you need, inserting the subsystem parameter is vital. |
| Domain           | Your Coralogix **[domain](https://coralogix.com/docs/docs/user-guides/account-management/account-settings/coralogix-domain/.md)**                                                                                                                                                                                                                                                                        |

**STEP 2**. Save this log file as `example.log`.

```
2023-06-19 05:20:50 ERROR This is a test error message

2023-06-20 12:50:00 DEBUG This is a test debug message

2023-06-21 12:34:56 INFO This is a test info message
```

**STEP 3**. Run the example file. Choose the command that mirrors your installation type.

* OTEL installed as an application

```
./otelcol-contrib --config config.yaml
```

* OTEL installed as a service

```
otelcol-contrib --config config.yaml
```

## **Validation**[​](#validation "Direct link to validation")

Validate your configuration.

### Logs[​](#logs "Direct link to Logs")

In your Coralogix navigation pane, click **LiveTrail** **> Start** to view your logs.

[![](/docs/assets/images/Untitled-2-1024x59-fd32bd3728e092dd2edefb87a62588e0.jpeg)](https://coralogix.com/docs/docs/assets/images/Untitled-2-1024x59-fd32bd3728e092dd2edefb87a62588e0.jpeg)

[![](/docs/assets/images/Untitled-19-1024x675-9ef0fbc7b0cd0ed5ab7c6057cf8ed13d.webp)](https://coralogix.com/docs/docs/assets/images/Untitled-19-1024x675-9ef0fbc7b0cd0ed5ab7c6057cf8ed13d.webp)

### Metrics[​](#metrics "Direct link to Metrics")

**STEP 1**. Navigate to [hosted Grafana view](https://coralogix.com/docs/docs/user-guides/visualizations/hosted-grafana-view/.md).

**STEP 2**. In the left-hand panel, click **Explore > Metrics browser.** Select the metrics that you would like to see.

[![](/docs/assets/images/Untitled-3-1-c3df6aa5f4f51395ce6653a7b2929f6f.jpeg)](https://coralogix.com/docs/docs/assets/images/Untitled-3-1-c3df6aa5f4f51395ce6653a7b2929f6f.jpeg)

## Additional Resources[​](#additional-resources "Direct link to Additional Resources")

|               |                                                                                    |
| ------------- | ---------------------------------------------------------------------------------- |
| Documentation | [OpenTelemetry](https://coralogix.com/docs/docs/opentelemetry/getting-started/.md) |
