-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prometheus metrics #18
Draft
eldarnash
wants to merge
4
commits into
main
Choose a base branch
from
prometheus-metrics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
title: Prometheus-like metrics | ||
weight: 3800 | ||
type: docs | ||
cascade: | ||
type: docs | ||
--- | ||
|
||
Starting with version 4.0, {{% param "product.abbrev" %}} provides a new metric naming scheme (labeling capability) to provide metrics and statistics about the processed events. You can query the metrics using `syslog-ng-ctl`, which can produce Prometheus-like metric exports. | ||
|
||
<!-- FIXME add/mention the new metrics exporter? https://github.com/axoflow/axosyslog-metrics-exporter --> | ||
|
||
Metrics are identified by names and partitioned by labels, similarly to the [Prometheus data model](https://prometheus.io/docs/concepts/data_model/), in the following format: `<metric-name>{<id>, <labels>} <value-of-the-metric>` | ||
|
||
The part with the curly braces is optional, and not used for certain metrics. For example: | ||
|
||
```shell | ||
syslogng_events_allocated_bytes 18446744073709550560 | ||
syslogng_filtered_events_total{id="#anon-filter0",result="matched"} 0 | ||
``` | ||
|
||
Note that: | ||
|
||
- The order of the labels doesn't matter. | ||
- A label with an empty value is equivalent to a non-existing label. | ||
- If the related queue is specific to a worker, it also has the `worker` label. | ||
- If there is no information about the worker of the driver, it has the `abandoned=true` label. | ||
|
||
For example: | ||
|
||
```shell | ||
syslog-ng-ctl stats prometheus | ||
``` | ||
|
||
The output is similar to: | ||
|
||
```shell | ||
syslogng_events_allocated_bytes 18446744073709550560 | ||
syslogng_filtered_events_total{id="#anon-filter0",result="matched"} 0 | ||
syslogng_filtered_events_total{id="#anon-filter0",result="not_matched"} 2 | ||
syslogng_filtered_events_total{id="ff",result="matched"} 0 | ||
syslogng_filtered_events_total{id="ff",result="not_matched"} 2 | ||
syslogng_input_events_total{id="#anon-source0#0",driver_instance="-",result="processed"} 0 | ||
syslogng_input_events_total{id="s_network#1",result="processed"} 2 | ||
syslogng_internal_source{result="dropped"} 0 | ||
syslogng_internal_source{result="queued"} 0 | ||
syslogng_output_events_total{id="d_dest#0",driver_instance="tcp,127.0.0.1:5555",result="delivered"} 0 | ||
syslogng_output_events_total{id="d_dest#0",driver_instance="tcp,127.0.0.1:5555",result="dropped"} 0 | ||
syslogng_output_events_total{id="d_dest#0",driver_instance="tcp,127.0.0.1:5555",result="queued"} 0 | ||
syslogng_output_events_total{id="d_dest#1",driver_instance="http,https://localhost:8080",result="delivered"} 0 | ||
syslogng_output_events_total{id="d_dest#1",driver_instance="http,https://localhost:8080",result="dropped"} 0 | ||
syslogng_output_events_total{id="d_dest#1",driver_instance="http,https://localhost:8080",result="queued"} 0 | ||
syslogng_parsed_events_total{id="#anon-parser0",result="discarded"} 0 | ||
syslogng_parsed_events_total{id="#anon-parser0",result="processed"} 0 | ||
syslogng_scratch_buffers_bytes 0 | ||
syslogng_scratch_buffers_total 3 | ||
syslogng_tagged_events_total{id=".source.#anon-source0",result="processed"} 0 | ||
syslogng_tagged_events_total{id=".source.s_network",result="processed"} 2 | ||
``` | ||
|
||
## Legacy metrics | ||
|
||
You can access the [old statistics]({{< relref "/chapter-log-statistics/_index.md" >}}) of {{% param "product.abbrev" %}} in the new format by running: | ||
|
||
```shell | ||
syslog-ng-ctl stats prometheus --with-legacy-metrics | ||
``` | ||
|
||
The output should be similar to: | ||
|
||
```shell | ||
syslogng_src_facility_processed{stat_instance="18"} 0 | ||
syslogng_dst_network_memory_usage{id="d_dest#0",stat_instance="tcp,127.0.0.1:5555"} 0 | ||
syslogng_src_host_processed{id="s_network#1",stat_instance="AnnoW"} 2 | ||
syslogng_global_sdata_updates_processed 0 | ||
syslogng_global_msg_clones_processed 0 | ||
syslogng_global_internal_queue_length_processed 0 | ||
syslogng_global_payload_reallocs_processed 4 | ||
... | ||
``` | ||
|
||
For a detailed list of available metrics, see {{% xref "/metrics/reference-metrics/_index.md" %}}. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
driver_instance
has been replaced with custom labels. I'll share some fresh examples soon.