Syslog collection: eventlog + syslog-ng + mongodb

Source: Internet
Author: User


Syslog collection: eventlog + syslog-ng + mongodb system: Redhat5 64bit Server www.2cto.com Java code 1. install eventlog $ tar xvfz eventlog_0.2.12.tar.gz // decompress $ export PKG_CONFIG_PATH =/usr/local/lib/pkgconfig: $ PKG_CONFIG_PATH // configure the compilation path $. /configure // configure the compiling environment and pre-compile $ make // compile $ make install // install 2. install syslog-ng $ tar xvfz syslog-ng_3.3.7.tar.gz // unzip $. /configure // configure the compiling environment, pre-compile $ make // compile $ make install // install # configure syslog-ng to start as a service # enter the contrib directory $ cd contrib # copy the service startup script to init. d directory $ cp init. d. redHat-7.3/etc/init. d/syslog-ng $ chmod 755/etc/init. d/syslog-ng $ chown root: root/etc/init. d/syslog-ng $ chkconfig-add syslog-ng $ chkconfig -- level 345 syslog-ng on $ service syslog-ng start www.2cto.com 3. configure syslog-ng, mainly configure two files // receive syslog messages in UDP mode, and send to the mongodb syslog-ng.conf: 127.0.0.1 is the IP address of mongodb, the default port is 27017, the database is syslog, the table is the messages module. conf: # enable mongodb receiving @ module afmongodb 4. install mongodb # unzip, install, service $ tar zxvf mongodb-linux-x86_64-2.0.8.tgz $ mv mongodb-linux-x86_64-2.0.8/usr/local/mongodb $ mkdir/data/db $ mkdir/data/logs $ cp mongodb.txt/etc/init. d/mongodb $ chmod 755/etc/init. d/mongodb $ chown root: root/etc/init. d/mongodb $ chkconfig-add mongodb $ chkconfig -- level 345 mongodb on $ service mongodb start # create an index $ cd/usr/local/mongodb/bin $. /mongo $ show dbs $ use syslog $ db. messages. find () $ db. messages. ensureIndex ({"DATE":-1, "HOST":-1, "SOURCEIP":-1, "PRIORITY":-1, "FACILITY":-1 })

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.