This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
сервис_opentelemetry [2026/11/03 11:44] val |
сервис_opentelemetry [2026/11/05 15:10] (current) val [OpenTelemetry Collector] |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| # dpkg -i otelcol-contrib_0.162.0_linux_amd64.deb | # dpkg -i otelcol-contrib_0.162.0_linux_amd64.deb | ||
| - | </code> | + | </code><code> |
| - | + | ||
| - | * [[Регистрация событий в Linux#Сервис rsyslog]] | + | |
| - | * [[Поиск важных событий в syslog]] (Вариант 1) | + | |
| - | + | ||
| - | <code> | + | |
| # cat /etc/otelcol-contrib/config.yaml | # cat /etc/otelcol-contrib/config.yaml | ||
| </code><code> | </code><code> | ||
| Line 20: | Line 15: | ||
| convert_to_semantic_conventions: true | convert_to_semantic_conventions: true | ||
| resource: | resource: | ||
| - | service.name: ИМЯСИСТЕМЫ-journald | + | service.name: ИМЯ_СИСТЕМЫ-journald |
| + | #Можно и просто journald , так как ниже добавляется и индексируется host_name | ||
| # filelog/roundcube: | # filelog/roundcube: | ||
| Line 27: | Line 23: | ||
| # start_at: end | # start_at: end | ||
| # resource: | # resource: | ||
| - | # service.name: roundcube-mail | + | # service.name: server-roundcube |
| # operators: | # operators: | ||
| # - type: regex_parser | # - type: regex_parser | ||
| Line 42: | Line 38: | ||
| processors: | processors: | ||
| batch: | batch: | ||
| - | filter/exclude_unimportant: | + | # filter/exclude_unimportant: |
| + | # error_mode: ignore | ||
| + | # logs: | ||
| + | # log_record: | ||
| + | # - 'IsMatch(body, "(?i)cron")' | ||
| + | transform: | ||
| error_mode: ignore | error_mode: ignore | ||
| - | logs: | + | log_statements: |
| - | log_record: | + | - context: log |
| - | - 'IsMatch(body, "(?i)cron")' | + | statements: |
| + | - set(resource.attributes["syslog_identifier"], attributes["syslog.identifier"]) where attributes["syslog.identifier"] != nil | ||
| + | - set(resource.attributes["host_name"], resource.attributes["host.name"]) where resource.attributes["host.name"] != nil | ||
| + | - set(resource.attributes["loki.resource.labels"], "syslog_identifier, host_name") | ||
| exporters: | exporters: | ||
| Line 62: | Line 66: | ||
| receivers: [journald] | receivers: [journald] | ||
| # receivers: [journald, filelog/roundcube] | # receivers: [journald, filelog/roundcube] | ||
| - | processors: [filter/exclude_unimportant, batch] | + | processors: [transform, batch] |
| + | # processors: [filter/exclude_unimportant, transform, batch] | ||
| exporters: [otlphttp/loki] | exporters: [otlphttp/loki] | ||
| # exporters: [otlphttp/loki, debug] | # exporters: [otlphttp/loki, debug] | ||
| Line 70: | Line 75: | ||
| # usermod -aG systemd-journal otelcol-contrib | # usermod -aG systemd-journal otelcol-contrib | ||
| - | # service otelcol-contrib restart | + | # #ls -l /var/log/roundcube/ |
| + | # #usermod -aG adm otelcol-contrib | ||
| - | # ###journalctl -f | + | # service otelcol-contrib restart |
| </code> | </code> | ||