13.2.3 Procedure required to change the listening port for scraping used by the log metrics feature
Perform the following to change the listening port used for scraping by the log metrics feature. However, the listen port used by Fluentd (the log metrics feature) depends on the worker_id of the worker who starts as the multi-process workers feature. For this reason, it is necessary to refer to the following formula and make sure that port numbers are not duplicated on the host that uses the log metrics function.
port#1 + worker_id#2
- #1
-
The value specified in (1) Specifying the port number for scraping used by Fluentd
- #2
-
The value specified for worker-id in Log metrics definition file (fluentd_any-name_logmetrics.conf)
- Organization of this subsection
(1) Specifying the port number for scraping used by Fluentd
Specify the port number for scraping used by the fluent-plugin-prometheus plug-in in the log metrics definition file.
Specify the listening port number for port in <source> described in the following example of changes.
Example of changes:
## Input
<worker worker-ids-used-for-the-log-metrics-feature>
<source>
@type prometheus
bind 0.0.0.0
port listening-port-number
metrics_path /metrics
</source>
</worker>
<worker worker-id>
<source>
(Omitted)
</source>
(Omitted below)
(2) Changing the port number for scraping used by Prometheus
Change the port number for scraping defined in the Prometheus discovery configuration file to the listening-port-number specified in (1) Specifying the port number for scraping used by Fluentd.
Change the listening-port-number+worker-id for targets in the following example of changes.
- targets: - name-of-monitored-host:listening-port-number+worker-id (Omitted) labels: (Omitted)