back

Number generator and counter module (mmsequence)

Module Name:    mmsequence

Author: Pavel Levshin <pavel@levshin.spb.ru>

Status: Non project-supported module - contact author or rsyslog mailing list for questions

Available since: 7.5.6

Description:

This module generates numeric sequences of different kinds. It can be used to count messages up to a limit and to number them. It can generate random numbers in a given range.

This module is implemented via the output module interface, so it is called just as an action. The number generated is stored in a variable.

 

Action Parameters:

Sample:

# load balance
Ruleset(
    name="logd"
    queue.workerthreads="5"
    ){

    Action(
        type="mmsequence"
        mode="instance"
        from="0"
        to="2"
        var="$.seq"
    )

    if $.seq == "0" then {
        Action(
            type="mmnormalize"
            userawmsg="on"
            rulebase="/etc/rsyslog.d/rules.rb"
        )
    } else {
        Action(
            type="mmnormalize"
            userawmsg="on"
            rulebase="/etc/rsyslog.d/rules.rb"
        )
    }

    # output logic here
}
    # generate random numbers
    action(
        type="mmsequence"
        mode="random"
        to="100"
        var="$!rndz"
    )
    # count from 0 to 99
    action(
        type="mmsequence"
        mode="instance"
        to="100"
        var="$!cnt1"
    )
    # the same as before but the counter is global
    action(
        type="mmsequence"
        mode="key"
        key="key1"
        to="100"
        var="$!cnt2"
    )
    # count specific messages but place the counter in every message
    if $msg contains "txt" then
        action(
            type="mmsequence"
            mode="key"
            to="100"
            var="$!cnt3"
        )
    else
        action(
            type="mmsequence"
            mode="key"
            to="100"
            step="0"
            var="$!cnt3"
            key=""
        )

Legacy Configuration Directives:

Not supported.

[rsyslog.conf overview] [manual index] [rsyslog site]

This documentation is part of the rsyslog project.
Copyright © 2008-2013 by Rainer Gerhards and Adiscon. Released under the GNU GPL version 3 or higher.