# dyn_inc()

## Purpose

dyn_inc(bucket_name_literal_string, str)

Increments counter identified by `str` in dyn-stats bucket identified by `bucket_name_literal_string`. Returns 0 when increment is successful, any other return value indicates increment failed.

Counters updated here are reported by impstats.

Except for special circumstances (such as memory allocation failing etc), increment may fail due to metric-name cardinality being under-estimated. Bucket is configured to support a maximum cardinality (to prevent abuse) and it rejects increment-operation if it encounters a new(previously unseen) metric-name(`str`) when full.

Read more about it here Dynamic Stats

## Example

The following example shows the counter $hostname incremented in the bucket msg_per_host.

    dyn_inc("msg_per_host", $hostname)

See also

Help with configuring/using `Rsyslog`:

- Mailing list - best route for general questions
- GitHub: rsyslog source project - detailed questions, reporting issues that are believed to be bugs with `Rsyslog`
- Stack Exchange (View, Ask) - experimental support from rsyslog community

See also

Contributing to `Rsyslog`:

- Source project: rsyslog project README.
- Documentation: rsyslog-doc project README

Copyright 2008-2020 Rainer Gerhards (Großrinderfeld), and Others.