Gentoo Archives: gentoo-user

From: "Stefan G. Weichinger" <lists@×××××.at>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] aggregate logs into Elasticsearch
Date: Thu, 09 Apr 2020 08:42:33
Message-Id: e8c414d2-8846-8e2d-0b2f-0749cdbe30a5@xunil.at
In Reply to: Re: [gentoo-user] aggregate logs into Elasticsearch by Ralph Seichter
1 Am 04.04.20 um 16:02 schrieb Ralph Seichter:
2 > * Stefan G. Weichinger:
3 >
4 >> Maybe I look into mongodb as well, for example I found this small
5 >> howto: https://www.fluentd.org/guides/recipes/maillog-mongodb
6 >
7 > That looks unnecessarily complicated to me. While you can of course move
8 > data from an existing log file into MongoDB, I find configuring syslog
9 > to use a MongoDB destination (in addition to your files or as a full
10 > replacement) much easier.
11 >
12 > See [1] section "Storing messages in a MongoDB database". I have also
13 > done it with rsyslog, but that took a bit more work.
14 >
15 > Here's a syslog-ng destination I use. Note that using uri() allows
16 > passing parameters to modern MongoDB drivers which the older servers()
17 > statement cannot cope with.
18 >
19 > destination d_mongo {
20 > mongodb(
21 > uri("mongodb://user:pw@hostname:27017/syslog?authSource=admin&ssl=true")
22 > collection("messages")
23 > value-pairs(
24 > scope("selected-macros" "nv-pairs")
25 > pair("DATE", datetime("$UNIXTIME"))
26 > pair("PID", int64("$PID"))
27 > pair("SEQNUM", int64("$SEQNUM"))
28 > exclude("HOST*")
29 > exclude("LEGACY*")
30 > exclude("SOURCE*")
31 > exclude("TAGS")
32 > )
33 > );
34 > };
35 >
36 > Values are strings to begin with. This example excludes some values I am
37 > not interested in, and performs type conversion on others, for example
38 > mapping DATE to MongoDB's date/time data type (see ISODate) and PID to a
39 > numeric value. Conversion can of course happen during analysis, but
40 > since syslog-ng is smart enough to do it when writing data, I prefer
41 > that.
42 >
43 > [1] https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.16/administration-guide/37#TOPIC-956524
44
45 Thanks a lot ... I think I will postpone that project ;-)