Reputation: 11
I'm using tail and fluent-plugin-mongo to write Apache Combined Log Format into mongoDB but I want to custom some attribute format to write into mongoDB such as
{
ip : 21.18.104.8
host : www.sample.com
message : buildtime=2012_02_14_16_25;version=01.03.3752;totalTimeMin=0;
}
to
{
ip : 21.18.104.8
host : www.sample.com
message : buildtime=2012_02_14_16_25;version=01.03.3752;totalTimeMin=0;
buildtime : 2012_02_14_16_25
version : 01.03.3752
totalTimeNin : 0
}
change datetime format from ISODate("2011-11-27T07:56:34Z" to "2011-11-27 07:56:34"
ceiling timestamp to the nearest 5 minutes eg. 12:33:22 => 12:35:00
add some function such as from
{
ip : 69.249.69.211
host : www.sample.com
message : buildtime=2012_02_14_16_25;version=01.03.3752;totalTimeMin=0;
}
to
{
ip : 69.249.69.211
country : US
host : www.sample.com
message : buildtime=2012_02_14_16_25;version=01.03.3752;totalTimeMin=0;
}
Is that possible to do? I don't have any ideas which plugins I should use. I've already read docs but I did't get it since it doesn't have many examples.
Upvotes: 1
Views: 967
Reputation: 1441
You can extend in_tail plugin to achieve your goals. The URL below describes how to do it.
http://docs.fluentd.org/articles/plugin-development#custom-parser-for-tail-input-plugin
If you have any question, please ask me here or Google Groups. Thanks -K
Upvotes: 1