From: Ralph Seichter <abbot@monksofcool.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] aggregate logs into Elasticsearch
Date: Sat, 04 Apr 2020 16:02:50 +0200 [thread overview]
Message-ID: <87tv1zfiwl.fsf@wedjat.horus-it.com> (raw)
In-Reply-To: <8e156bd2-0bc6-94bb-caba-dbac8f80bf35@xunil.at>
* Stefan G. Weichinger:
> Maybe I look into mongodb as well, for example I found this small
> howto: https://www.fluentd.org/guides/recipes/maillog-mongodb
That looks unnecessarily complicated to me. While you can of course move
data from an existing log file into MongoDB, I find configuring syslog
to use a MongoDB destination (in addition to your files or as a full
replacement) much easier.
See [1] section "Storing messages in a MongoDB database". I have also
done it with rsyslog, but that took a bit more work.
Here's a syslog-ng destination I use. Note that using uri() allows
passing parameters to modern MongoDB drivers which the older servers()
statement cannot cope with.
destination d_mongo {
mongodb(
uri("mongodb://user:pw@hostname:27017/syslog?authSource=admin&ssl=true")
collection("messages")
value-pairs(
scope("selected-macros" "nv-pairs")
pair("DATE", datetime("$UNIXTIME"))
pair("PID", int64("$PID"))
pair("SEQNUM", int64("$SEQNUM"))
exclude("HOST*")
exclude("LEGACY*")
exclude("SOURCE*")
exclude("TAGS")
)
);
};
Values are strings to begin with. This example excludes some values I am
not interested in, and performs type conversion on others, for example
mapping DATE to MongoDB's date/time data type (see ISODate) and PID to a
numeric value. Conversion can of course happen during analysis, but
since syslog-ng is smart enough to do it when writing data, I prefer
that.
[1] https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.16/administration-guide/37#TOPIC-956524
-Ralph
next prev parent reply other threads:[~2020-04-04 14:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-03 11:40 [gentoo-user] aggregate logs into Elasticsearch Stefan G. Weichinger
2020-04-03 15:57 ` Ralph Seichter
2020-04-04 7:43 ` Stefan G. Weichinger
2020-04-04 14:02 ` Ralph Seichter [this message]
2020-04-09 8:42 ` Stefan G. Weichinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tv1zfiwl.fsf@wedjat.horus-it.com \
--to=abbot@monksofcool.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox