|
| 1 | +--- |
| 2 | +title: loki() destination options |
| 3 | +id: adm-dest-loki-opt |
| 4 | +--- |
| 5 | + |
| 6 | +The `loki()` driver sends messages to a Loki Grafana database and has the following options: |
| 7 | + |
| 8 | +## auth() |
| 9 | + |
| 10 | +The `auth()` option can be used to set the authentication of the driver. The default state of this option is `insecure`, as it is not defined. |
| 11 | + |
| 12 | +The following sub-options are available for `auth()`. |
| 13 | + |
| 14 | +### adc() |
| 15 | + |
| 16 | +This option is an authentication method that is only available for destinations. For more information, see Application Default Credentials. |
| 17 | + |
| 18 | +### alts() |
| 19 | + |
| 20 | +This option is an accessible authentication available for Google infrastructures. Service accounts can be listed with the nested `target-service-account()` option, to match these against the server. |
| 21 | + |
| 22 | +#### Example: configure a Loki destination using auth(alts()) |
| 23 | + |
| 24 | +```config |
| 25 | +destination { |
| 26 | + loki( |
| 27 | + port(1234) |
| 28 | + auth(alts()) |
| 29 | + ); |
| 30 | + }; |
| 31 | +``` |
| 32 | + |
| 33 | +### insecure() |
| 34 | + |
| 35 | +This option can be used to disable authentication: `auth(insecure())`. |
| 36 | + |
| 37 | +### tls() |
| 38 | + |
| 39 | +The `tls()` option accepts the following nested sub-options. |
| 40 | +* ca-file() |
| 41 | +* key-file() |
| 42 | +* cert-file() |
| 43 | + |
| 44 | +#### Example: configure a Loki destination using auth(tls()) |
| 45 | + |
| 46 | +```config |
| 47 | +destination { |
| 48 | + loki( |
| 49 | + url("loki-server:123") |
| 50 | + auth( |
| 51 | + tls( |
| 52 | + ca-file("/path/to/ca.pem") |
| 53 | + key-file("/path/to/key.pem") |
| 54 | + cert-file("/path/to/cert.pem") |
| 55 | + ) |
| 56 | + ) |
| 57 | + ); |
| 58 | + }; |
| 59 | +``` |
| 60 | + |
| 61 | +{% include doc/admin-guide/options/batch-bytes.md %} |
| 62 | + |
| 63 | +{% include doc/admin-guide/options/batch-lines.md %} |
| 64 | + |
| 65 | +{% include doc/admin-guide/options/batch-timeout.md %} |
| 66 | + |
| 67 | +{% include doc/admin-guide/options/channel-args.md %} |
| 68 | + |
| 69 | +{% include doc/admin-guide/options/gRPC-keep-alive.md %} |
| 70 | + |
| 71 | +## labels() |
| 72 | + |
| 73 | +This option defines the labels applied to the message as they are sent to the destination. |
| 74 | + |
| 75 | +**Declaration:** |
| 76 | + |
| 77 | +```config |
| 78 | +labels( |
| 79 | + "label-output-name" => "field-of-the-message" |
| 80 | +) |
| 81 | +``` |
| 82 | + |
| 83 | +## template() |
| 84 | + |
| 85 | +| Type:| template or template-function| |
| 86 | +|Default:| ${ISODATE} ${HOST} ${MSGHDR} ${MSG}| |
| 87 | + |
| 88 | +*Description:* This option specifies a template that defines the logformat to be used in the destination. For more information on macros and template functions, see Macros of syslog-ng OSE and Template functions of syslog-ng OSE. |
| 89 | + |
| 90 | +## tenant-id() |
| 91 | + |
| 92 | +| Type:| string| |
| 93 | +|Default:| | |
| 94 | + |
| 95 | +Available in syslog-ng OSE 4.7 and later versions. |
| 96 | + |
| 97 | +*Description:* This option sets the tenant ID for multi-tenant cases. |
| 98 | + |
| 99 | +**Declaration:** |
| 100 | + |
| 101 | +```config |
| 102 | +loki( |
| 103 | + url("localhost:9096") |
| 104 | + labels( |
| 105 | + "app" => "$PROGRAM", |
| 106 | + "host" => "$HOST", |
| 107 | + ) |
| 108 | +
|
| 109 | + tenant-id("testTenant") |
| 110 | +); |
| 111 | +``` |
| 112 | + |
| 113 | +## timestamp() |
| 114 | + |
| 115 | +| Type:| `current`, `received`, `msg`| |
| 116 | +|Default:| `current`| |
| 117 | + |
| 118 | +*Description:* This option sets the timestamp type to be used for messages sent to a Loki destination. |
| 119 | + |
| 120 | +**NOTE:** Loki destinations only accept subsequent messages with increasing timestamps. Messages with timestamps deviating from this are rejected. |
| 121 | +{: .notice--info} |
| 122 | + |
| 123 | +The timestamp types are the following. |
| 124 | + |
| 125 | +* `current`: The message procession output timestamp is used. This type guarantees an increasing timestamp order, but can deviate significantly from the message generation time. |
| 126 | +* `msg`: The original timestamp of the message is used. |
| 127 | +* `received`: The timestamp of message reception is used. |
| 128 | + |
| 129 | +## url() |
| 130 | + |
| 131 | +| Type:| string| |
| 132 | +|Default:| localhost:9095| |
| 133 | + |
| 134 | +*Description:* This option specifies the URL of the Loki endpoint. |
| 135 | + |
| 136 | +{% include doc/admin-guide/options/workers.md %} |
0 commit comments