Skip to content
doryokujin edited this page Nov 14, 2011 · 12 revisions

back

Input

Tue Nov 15 00:48:06 [conn16] command admin.$cmd command: { ismaster: 1 } ntoreturn:1 reslen:234 0ms
Tue Nov 15 00:48:06 [conn10] run command admin.$cmd { replSetGetStatus: 1 }
Tue Nov 15 00:48:06 [conn10] command admin.$cmd command: { replSetGetStatus: 1 } ntoreturn:1 reslen:571 0ms
Tue Nov 15 00:48:06 [conn16] run command admin.$cmd { replSetGetStatus: 1 }
Tue Nov 15 00:48:06 [conn16] command admin.$cmd command: { replSetGetStatus: 1 } ntoreturn:1 reslen:571 0ms
Tue Nov 15 00:48:06 [conn4] run command admin.$cmd { replSetHeartbeat: "shard17", v: 1, pv: 1, checkEmpty: false, from: "delta5:2317" }
Tue Nov 15 00:48:06 [conn4] command admin.$cmd command: { replSetHeartbeat: "shard17", v: 1, pv: 1, checkEmpty: false, from: "delta5:2317" } ntoreturn:1 reslen:123 0ms
Tue Nov 15 00:48:07 [conn83] getmore local.oplog.rs query: { ts: { $gte: new Date(5674635710599004183) } } cursorid:723414340912575222 reslen:20 2151ms
Tue Nov 15 00:48:07 [conn2] run command admin.$cmd { replSetHeartbeat: "shard17", v: 1, pv: 1, checkEmpty: false, from: "delta16:2417" }
Tue Nov 15 00:48:07 [conn2] command admin.$cmd command: { replSetHeartbeat: "shard17", v: 1, pv: 1, checkEmpty: false, from: "delta16:2417" } ntoreturn:1 reslen:123 0ms

Goal

ex_fluent-plugin-aggregation

Configuration

<source>
    type tail
    format /^(?<time>[^ ]* [^ ]*[ ]*[^ ]* [0-9]{2}:[0-9]{2}):(?<second>[0-9]{2}) \[(?<key1>[^\]]*)\] (?<key2>[^ ]*) (?<key3>[^ ]*) (?<message>.*)$/
    time_format %a %b %e %H:%M
    path /var/log/mongo/mongo.log
    tag aggr_delta*
</source>

<match aggr_delta**>
    ...
    <metrics>
        name two_keys
        partition_by m
        each_key key2,key3
        value_key second
        type float
    </metrics>
    <metrics>
        name one_key
        partition_by m
        each_key key1
    </metrics>
    ...
</match>

see configuration example more detail.

Result

> db.aggr.find().limit(3).forEach(printjson)
{
        "_id" : "7411aefc0077ec3975e41052e886679a",
        "count" : 422,
        "key" : {
                "key1" : "conn2"
        },
        "name" : "one_key",
        "partition" : "2011-11-15 00:42"
}
{
        "_id" : "8894e98ae09481f834c43007cc562363",
        "count" : 19,
        "key" : {
                "key1" : "conn84"
        },
        "name" : "one_key",
        "partition" : "2011-11-15 00:42"
}
{
        "_id" : "e1cda4dea9e4430c851bce013d24638b",
        "count" : 116,
        "key" : {
                "key2" : "getmore",
                "key3" : "local.oplog.rs"
        },
        "name" : "two_keys",
        "partition" : "2011-11-15 00:42",
        "value" : {
                "second" : 2422
        }
}
Clone this wiki locally