# Vector

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

Coralogix provides seamless integration with Vector so you can send your logs from anywhere and parse them according to your needs.

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

* Vector [installed](https://vector.dev/docs/setup/installation/)

* For those customers with a [Kubernetes](https://kubernetes.io/) environment, Helm 2.9+ Package Manager [installed](https://helm.sh/)

## Usage[​](#usage "Direct link to Usage")

You must input the following variables when creating a Coralogix logger instance or updating your configuration file:

* `` `api_key` ``: Input your Coralogix [Send-Your-Data API key](https://docs-docusaurus.kinsta.page/user-guides/account-management/api-keys/send-your-data-api-key/.md).

* `applicationName` and `subystemName`: Input [application and subsystem names](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/application-and-subsystem-names/.md).

* `coralogix_domain`: Input the Coralogix [domain](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/coralogix-domain/.md) associated with your account.

## Configuration for Non-Kubernetes Environments[​](#configuration-for-non-kubernetes-environments "Direct link to Configuration for Non-Kubernetes Environments")

**STEP 1. Edit default configuration file**

Edit the default configuration file vector.toml and paste the following configuration below. Update the following:

* event.log.applicationName = "VECTOR\_APP"

* event.log.subsystemName = "VECTOR\_SUBSYS"

* uri = Choose the <!-- -->https\://ingress./logs/v1/singles<!-- --> endpoint that corresponds to your Coralogix [domain](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/coralogix-domain/.md) using the domain selector at the top of the page.

* headers.authorization = "Bearer \<API\_KEY>"

```
# This input is just for test or demo purposes and is supported only since Vector v0.12.0. Feel free to use any other input.



[sources.my_source_id]

  type = "demo_logs" # required

  lines = ["{\"msg\":\"success\", \"code\":200}", "{\"msg\":\"error\", \"code\":500}"] # optional, no default, relevant when [`format`](#format) = `shuffle`

  sequence = false # optional, default, relevant when [`format`](#format) = `shuffle`

  batch_interval = 10

  format = "shuffle"



[transforms.prepare_for_coralogix]

  # General

  type = "lua" # required

  inputs = ["my_source_id"] # required

  version = "2" # required

  # Hooks

  hooks.process = '''

  function (event, emit)

    event.log = {

      applicationName = "VECTOR_APP",

      subsystemName = "VECTOR_SUBSYS",

      json = event.log,

      computerName = os.getenv("HOSTNAME"),

      timestamp = os.time() * 1000

    }

    emit(event)

  end

  '''



[sinks.coralogix]

  # General

  type = "http" # required

  inputs = ["prepare_for_coralogix"] # required

  compression = "none" # optional, default

  method = "post"

  uri = https://ingress.eu2.coralogix.com/logs/v1/singles # required

  # Batch

  batch.max_bytes = 1049000 # optional, default, bytes

  batch.timeout_secs = 2 # optional, default, seconds

  # Encoding

  encoding.codec = "json" # required

  # Healthcheck

  #healthcheck.enabled = true # optional, default

  headers.Content-Type = "application/json"

  headers.authorization = "Bearer <API_KEY>"
```

**STEP 2. Add your own sources**

That code will allow you to generate the test traffic. After testing the connection, add your own sources, as in the example below.

```
[sources.my_source_id]

  type = "file"

  include = ["/var/log/access.log "]
```

You can read more about this configuration [here](https://vector.dev/docs/reference/configuration/).

**STEP 3. Restart Vector**

Remember to restart Vector after every change to load updated configuration.

## Configuration for Kubernetes Environments[​](#configuration-for-kubernetes-environments "Direct link to Configuration for Kubernetes Environments")

**STEP 1. Add Helm chart repo**

```
helm repo add vector https://helm.vector.dev

helm repo update
```

**STEP 2. Create an override.yaml file**

Prior to installation create an override.yaml file and paste the following configuration below. Remember to update:

* event.log.applicationName = "VECTOR\_APP"

* event.log.subsystemName = "VECTOR\_SUBSYS"

* uri = Choose the <!-- -->https\://ingress./logs/v1/singles<!-- --> endpoint that corresponds to your Coralogix [domain](https://docs-docusaurus.kinsta.page/user-guides/account-management/account-settings/coralogix-domain/.md) using the domain selector at the top of the page.

* headers.authorization = "Bearer \<API\_KEY>"

```
# vector override.yaml

---

role: "Agent"



customConfig:

  sources:

    kubernetes_logs:

      type: kubernetes_logs



  transforms:

    prepare_for_coralogix:

      type: lua

      inputs: ["kubernetes_logs"]

      version: "2"

      #hooks

      hooks:

        process: |

            function (event, emit)

              event.log = {

                applicationName = "VECTOR_APP",

                subsystemName = "VECTOR_SUBSYS",

                json = event.log,

                computerName = os.getenv("HOSTNAME"),

                timestamp = os.time() * 1000

              }

              emit(event)

            end

      

  sinks:

    coralogix:

      type: http

      inputs: ["prepare_for_coralogix"]

      compression: none

      uri: https://ingress.eu2.coralogix.com/logs/v1/singles

      batch:

        maxbytes:

          1049000

        timeout_secs:

          2

      encoding:

        codec:

          json

      request:

        headers:

          Content-Type: application/json

          Authorization: "Bearer <<API_key>>"
```

**STEP 3. Deploy the chart**

```
helm install vector-agent vector/vector -f override.yaml
```

**STEP 4. Remove the Daemonset**

```
helm uninstall vector-agent
```

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

|                     |                                                                                                 |
| ------------------- | ----------------------------------------------------------------------------------------------- |
| Coralogix Endpoints | [Coralogix Endpoints](https://docs-docusaurus.kinsta.page/integrations/coralogix-endpoints/.md) |
