Skip to content

Commit 858c710

Browse files
sumoanemakimsauceJV0812
authored
ST with secrets - mysql, elasticsearch, postgresql. Customer facing doc for setting secrets as env variable (#4945)
* Doc for postgresql ST with some correction in doc for postgresql app * Rearranging folder structure and adding a note for metric collection support in different version of otel agent and postgresql * Correct file names, links, sidebars * Uncomment postgresql source template docs * ST with secrets - postgresql updated. Mysql and elasticsearch doc added * Changes from master merged * Changelog for postgresql * Changes to sidebars st to include postgresql, mysql and elasticsearch and redirection link for them. Added an additional note for setting env in windows for stwith secrets * adding slug id to mysql and elasticsearch * minor fixes * cid redirect correction for st with secrets * mysql and elasticsearch changes for prerequisite for metrics - setting env variable * correction for processing rule referece which was calling PR check failure * Apply suggestions from code review Co-authored-by: Kim (Sumo Logic) <[email protected]> * Apply suggestions from code review Co-authored-by: Kim (Sumo Logic) <[email protected]> * monitor changes - adding note to let the user know naming convention for env varibales * Update in note for setting env varibales rules * Changes to put env setting doc in sidebar - rearraging its hierarchy and updating path in associated docs * cid-redirect update after changing location for st-with-secret doc * removing code snippet intended for beta and/or hidden docs * SUMO-255467 | note for not prefixing http in endpoint string for postgresql --------- Co-authored-by: Kim Pohas <[email protected]> Co-authored-by: Kim (Sumo Logic) <[email protected]> Co-authored-by: Jagadisha V <[email protected]>
1 parent 4f1e912 commit 858c710

File tree

12 files changed

+481
-3
lines changed

12 files changed

+481
-3
lines changed

cid-redirects.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,10 @@
17641764
"/cid/10321": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/windows",
17651765
"/cid/10322": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/docker",
17661766
"/cid/10323": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/nginx",
1767-
"/cid/10324": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/kafka",
1767+
"/cid/10340": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/kafka",
1768+
"/cid/10341": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/postgresql",
1769+
"/cid/10342": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/mysql",
1770+
"/cid/10343": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/elasticsearch",
17681771
"/cid/10325": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/apache/changelog",
17691772
"/cid/10326": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/linux/changelog",
17701773
"/cid/10327": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/localfile/changelog",
@@ -1776,6 +1779,10 @@
17761779
"/cid/10337": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/docker/changelog",
17771780
"/cid/10338": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/nginx/changelog",
17781781
"/cid/10339": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/kafka/changelog",
1782+
"/cid/10344": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/postgresql/changelog",
1783+
"/cid/10345": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/mysql/changelog",
1784+
"/cid/10346": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/elasticsearch/changelog",
1785+
"/cid/10347": "/docs/send-data/opentelemetry-collector/remote-management/source-templates/st-with-secrets",
17791786
"/cid/10822": "/docs/manage/manage-subscription/create-manage-orgs-flex",
17801787
"/cid/10817": "/docs/integrations/sumo-apps/cse",
17811788
"/cid/10818": "/docs/integrations/sumo-apps/cse",

docs/integrations/databases/opentelemetry/postgresql-opentelemetry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This app supports PostgreSQL version 9.6+.
1919

2020
We use the OpenTelemetry collector for PostgreSQL metric collection and for collecting PostgreSQL logs.
2121

22-
The diagram below illustrates the components of the PostgreSQL collection for each database server. OpenTelemetry collector runs on the same host as PostgreSQL, and uses the [PostgreSQL receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/postgresqlreceiver) to obtain PostgreSQL metrics, and the [Sumo Logic OpenTelemetry Exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter) to send the metrics to Sumo Logic. MySQL logs are sent to Sumo Logic through a [filelog receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver).
22+
The diagram below illustrates the components of the PostgreSQL collection for each database server. OpenTelemetry collector runs on the same host as PostgreSQL, and uses the [PostgreSQL receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/postgresqlreceiver) to obtain PostgreSQL metrics, and the [Sumo Logic OpenTelemetry Exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sumologicexporter) to send the metrics to Sumo Logic. PostgreSQL logs are sent to Sumo Logic through a [filelog receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver).
2323

2424
<img src='https://sumologic-app-data-v2.s3.amazonaws.com/dashboards/Postgresql-OpenTelemetry/PostgreSQL-Schematics.png' alt="Schematics" />
2525

@@ -107,7 +107,7 @@ import SetupColl from '../../../reuse/apps/opentelemetry/set-up-collector.md';
107107

108108
### Step 2: Configure integration
109109

110-
In this step, you will configure the yaml file required for Mysql collection.
110+
In this step, you will configure the yaml file required for PostgreSQL collection.
111111

112112
Below is the required input:
113113

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: changelog
3+
title: Changelog
4+
sidebar_label: Changelog
5+
description: Changelog for Elasticsearch source template for OpenTelemetry.
6+
---
7+
8+
## [1.0.0] - 2025-01-30
9+
10+
### Added
11+
- Initial version of Elasticsearch source template.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
slug: /send-data/opentelemetry-collector/remote-management/source-templates/elasticsearch
3+
title: Elasticsearch Source Template
4+
sidebar_label: Elasticsearch
5+
description: Learn about the Sumo Logic Elasticsearch source template for OpenTelemetry.
6+
---
7+
8+
import useBaseUrl from '@docusaurus/useBaseUrl';
9+
import Tabs from '@theme/Tabs';
10+
import TabItem from '@theme/TabItem';
11+
12+
13+
<img src={useBaseUrl('img/integrations/databases/elasticsearch.png')} alt="Thumbnail icon" width="100"/> <img src={useBaseUrl('img/send-data/otel-color.svg')} alt="Thumbnail icon" width="30"/>
14+
15+
The Elasticsearch source template creates an OpenTelemetry configuration that can be pushed to a remotely managed OpenTelemetry collector (abbreviated as otelcol). By creating this source template and pushing the config to the appropriate OpenTelemetry agent, you can ensure collection of Elasticsearch logs and metrics to Sumo Logic.
16+
17+
## Fields creation in Sumo Logic for Local File
18+
19+
If not already present, the following [Fields](/docs/manage/fields/) are created as part of source template creation.
20+
21+
- **`sumo.datasource`**. Fixed value of **elasticsearch**.
22+
- **`deployment.environment`**. This is a user-configured field set at the time of collector installation. It identifies the environment where the host resides, such as `dev`, `prod`, or `qa`.
23+
- **`db.cluster.name`**. User configured. Enter a uniquely identifiable name for your elasticsearch cluster to show in the Sumo Logic dashboards.
24+
- **`db.node.name`**. Includes the value of the hostname of the machine which is being monitored.
25+
26+
## Prerequisites
27+
28+
### For metrics collection
29+
30+
- The Elasticsearch metrics [receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/elasticsearchreceiver) queries the Elasticsearch [node stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html), [cluster health](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html) and [index stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html) endpoints in order to scrape metrics from a running Elasticsearch cluster. This receiver supports Elasticsearch versions 7.9+
31+
32+
- Make sure to set the Elasticsearch user's password as an environment variable for OpenTelemetry agent. Refer to the [Setting Environment Variables with Secret Values for Source Templates.](../st-with-secrets.md).
33+
34+
### For logs collection
35+
36+
Elasticsearch supports logging via local text log files. Elasticsearch logs have four levels of verbosity. To select a level, set `loglevel` to one of:
37+
38+
* **debug**. A lot of information, useful for development/testing.
39+
* **verbose**. Includes information not often needed, but logs less than debug.
40+
* **notice** (default value). Moderately verbose, ideal for production environments.
41+
* **warning**. Only important/critical messages are logged.
42+
43+
All logging settings are located in [Elasticsearch.conf](https://www.elastic.co/guide/en/elasticsearch/reference/current/logging.html). By default, Elasticsearch logs are stored in `/var/log/elasticsearch/ELK-<Clustername>.log`. The default directory for log files is listed in the Elasticsearch.conf file.
44+
45+
Ensure that the otelcol has adequate permissions to access all log file paths. Execute the following command:
46+
47+
```bash
48+
sudo setfacl -R -m d:u:otelcol-sumo:r-x,u:otelcol-sumo:r-x,g:otelcol-sumo:r-x <PATH_TO_LOG_FILE>
49+
```
50+
51+
import LogsCollectionPrereqisites from '../../../../../reuse/apps/logs-collection-prereqisites.md';
52+
53+
<LogsCollectionPrereqisites/>
54+
55+
import OtelWindowsLogPrereq from '../../../../../reuse/apps/opentelemetry/log-collection-prerequisite-windows.md';
56+
57+
<OtelWindowsLogPrereq/>
58+
59+
## Configuring the Elasticsearch source template
60+
61+
You can follow the below steps to set a remotely managed OpenTelemetry collector and push the source template to it.
62+
63+
### Step 1: Set up remotely managed OpenTelemetry collector
64+
65+
import CollectorInstallation from '../../../../../reuse/apps/opentelemetry/collector-installation.md';
66+
67+
<CollectorInstallation/>
68+
69+
### Step 2: Configure the source template
70+
71+
In this step, you will configure the yaml required for Elasticsearch collection. Below are the inputs required for configuration:
72+
73+
- **Name**. Name of the source template.
74+
- **Description**. Description for the source template.
75+
- **Log Filepath**. Location where the Elasticsearch logs are logged. Please refer to your elasticsearch.conf file.
76+
- **Endpoint**. Enter the url of the server you need to monitor. (default: `localhost:9200`).
77+
- **Username**. Enter the Elasticsearch username.
78+
- **Password Environment Variable Name**. Enter the Elasticsearch password environment variable name.
79+
- **Fields/Metadata**. You can provide any customer fields to be tagged with the data collected. By default, Sumo Logic tags `_sourceCategory` with the value otel/elasticsearch user needs to provide the value for `db.cluster.name`.
80+
81+
import OtelLogAdvanceOption from '../../../../../reuse/apps/opentelemetry/logs-advance-option-otel.md';
82+
83+
<OtelLogAdvanceOption/>
84+
85+
**Processing Rules**. You can add **processing rules** for logs/metrics collected. To learn more, refer to [Processing Rules](../../processing-rules/index.md).
86+
87+
### Step 3: Push the source template to the desired remotely managed collectors
88+
89+
import DataConfiguration from '../../../../../reuse/apps/opentelemetry/data-configuration.md';
90+
91+
<DataConfiguration/>
92+
93+
:::info
94+
Refer to the [changelog](changelog.md) for information on periodic updates to this source template.
95+
:::
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: changelog
3+
title: Changelog
4+
sidebar_label: Changelog
5+
description: Changelog for MySQL source template for OpenTelemetry.
6+
---
7+
8+
## [1.0.0] - 2025-01-30
9+
10+
### Added
11+
- Initial version of MySQL source template.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
slug: /send-data/opentelemetry-collector/remote-management/source-templates/mysql
3+
title: MySQL Source Template
4+
sidebar_label: MySQL
5+
description: Learn about the Sumo Logic MySQL source template for OpenTelemetry.
6+
---
7+
8+
import useBaseUrl from '@docusaurus/useBaseUrl';
9+
import Tabs from '@theme/Tabs';
10+
import TabItem from '@theme/TabItem';
11+
12+
13+
<img src={useBaseUrl('img/integrations/databases/mysql.png')} alt="Thumbnail icon" width="100"/> <img src={useBaseUrl('img/send-data/otel-color.svg')} alt="Thumbnail icon" width="30"/>
14+
15+
The MySQL source template creates an OpenTelemetry configuration that can be pushed to a remotely managed OpenTelemetry collector (abbreviated as otelcol). By creating this source template and pushing the config to the appropriate OpenTelemetry agent, you can ensure collection of MySQL logs and metrics to Sumo Logic.
16+
17+
## Fields creation in Sumo Logic for Local File
18+
19+
If not already present, the following [Fields](/docs/manage/fields/) are created as part of source template creation.
20+
21+
- **`sumo.datasource`**. Fixed value of **mysql**.
22+
- **`deployment.environment`**. This is a user-configured field set at the time of collector installation. It identifies the environment where the host resides, such as `dev`, `prod`, or `qa`.
23+
- **`db.cluster.name`**. User configured. Enter a uniquely identifiable name for your mysql cluster to show in the Sumo Logic dashboards.
24+
- **`db.node.name`**. Includes the value of the hostname of the machine which is being monitored.
25+
26+
## Prerequisites
27+
28+
### For metrics collection
29+
30+
- The MySQL metrics [receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/mysqlreceiver) collects metrics by querying MySQL's global status and InnoDB tables. This app has been tested with following MySQL versions: 8.0
31+
32+
- Make sure to set the MySQL user's password as an environment variable for the OpenTelemetry agent. Refer to [Setting Environment Variables with Secret Values for Source Templates](../st-with-secrets.md).
33+
34+
### For logs collection
35+
36+
MySQL logs are stored in log files. Slow query logs must be explicitly enabled to be able to be written to a log file. To configure the MySQL log file(s), locate your local `my.cnf` configuration file in the database directory.
37+
1. Open `my.cnf` in a text editor.
38+
2. Set the following parameters in the `[mysqld]` section:
39+
```sql
40+
[mysqld]
41+
log_error = /var/log/mysql/error.log
42+
slow_query_log=1
43+
slow_query_log_file = /var/log/mysql/mysql-slow.log
44+
long_query_time=2
45+
```
46+
* [Error Logs](https://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html). By default, error logs are enabled and are logged at file specified by the `log_error` key.
47+
* [Slow Query Logs](https://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html). `slow_query_log=1` enables logging of slow queries to the file specified by `slow_query_log_file`. Setting `long_query_time=2` will cause queries that take more than two seconds to execute to be logged. The default value of `long_query_time` is 10 seconds.
48+
* [General Query Logs](https://dev.mysql.com/doc/refman/5.7/en/query-log.html). We do not recommend enabling `general_log` for performance reasons. These logs are not used by the Sumo Logic MySQL app.
49+
3. Save the `my.cnf` file.
50+
4. Restart the MySQL server:
51+
```bash
52+
sudo mysql.server restart
53+
```
54+
Ensure that the otelcol has adequate permissions to access all log file paths. Execute the following command:
55+
56+
```bash
57+
sudo setfacl -R -m d:u:otelcol-sumo:r-x,u:otelcol-sumo:r-x,g:otelcol-sumo:r-x <PATH_TO_LOG_FILE>
58+
```
59+
60+
import LogsCollectionPrereqisites from '../../../../../reuse/apps/logs-collection-prereqisites.md';
61+
62+
<LogsCollectionPrereqisites/>
63+
64+
import OtelWindowsLogPrereq from '../../../../../reuse/apps/opentelemetry/log-collection-prerequisite-windows.md';
65+
66+
<OtelWindowsLogPrereq/>
67+
68+
## Configuring the MySQL source template
69+
70+
You can follow the below steps to set a remotely managed OpenTelemetry collector and push the source template to it.
71+
72+
### Step 1: Set up remotely managed OpenTelemetry collector
73+
74+
import CollectorInstallation from '../../../../../reuse/apps/opentelemetry/collector-installation.md';
75+
76+
<CollectorInstallation/>
77+
78+
### Step 2: Configure the source template
79+
80+
In this step, you will configure the yaml required for MySQL collection. Below are the inputs required for configuration:
81+
82+
- **Name**. Name of the source template.
83+
- **Description**. Description for the source template.
84+
- **Error log path**. Location where the SQL Errors are logged. Please refer to your my.cnf file.
85+
- **Slow Transaction log file path (optional)**. Location where the Slow SQL transactions are logged. Please refer to your my.cnf file.
86+
- **Endpoint**. The URL of the MySQL endpoint (default: `localhost:3306`).
87+
- **Username**. Enter the MySQL username.
88+
- **Password Environment Variable Name**. Enter the MySQL password environment variable name.
89+
- **Fields/Metadata**. You can provide any customer fields to be tagged with the data collected. By default, Sumo Logic tags `_sourceCategory` with the value otel/mysql user needs to provide the value for `db.cluster.name`.
90+
91+
import OtelLogAdvanceOption from '../../../../../reuse/apps/opentelemetry/logs-advance-option-otel.md';
92+
93+
<OtelLogAdvanceOption/>
94+
95+
**Processing Rules**. You can add **processing rules** for logs/metrics collected. To learn more, refer to [Processing Rules](../../processing-rules/index.md).
96+
97+
### Step 3: Push the source template to the desired remotely managed collectors
98+
99+
import DataConfiguration from '../../../../../reuse/apps/opentelemetry/data-configuration.md';
100+
101+
<DataConfiguration/>
102+
103+
:::info
104+
Refer to the [changelog](changelog.md) for information on periodic updates to this source template.
105+
:::
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
id: changelog
3+
title: Changelog
4+
sidebar_label: Changelog
5+
description: Changelog for PostgreSQL source template for OpenTelemetry.
6+
---
7+
## [1.0.0] - 2025-01-30
8+
### Added
9+
- Initial version of PostgreSQL source template.

0 commit comments

Comments
 (0)