Log file monitoring Tool-Logstash

Source: Internet
Author: User
Tags redis logstash redis server

Recently in the use of Logstash for log collection, very convenient open-source software software, open the package is used, using JRuby to develop, hehe, I saw not Java development of open source projects, there is a kind of inexplicable resistance, strange and strange, but I go to their jira system, Found inside is still very active, Jira address: Https://logstash.jira.com/secure/Dashboard.jspa.

Let's talk about the usage of Logstash here first.

Download Logstash jar file, Https://download.elasticsearch.org/logstash/logstash/logstash-1.2.2-flatjar.jar

There is an official scene is Logstash monitoring log files, unified spit into the Redis server, in a Logstash read log, and stored to elasticsearch, I feel this piece is very useful, specific address:/HTTP Logstash.net/docs/1.2.2/tutorials/getting-started-centralized.


To start Logstash, you first have a configuration file, sample.conf, which contains an input field and an output domain, and you can also set filter and codecs.

Input is the source of the file, there are many ways to specify it, wildcard characters are supported, and multiple files can be specified.

Output is the export of the file, you can set the output to multiple target sources, where it is specified to output to Redis server, and the type of output is List,key is the name of each log, it is exported as a map by default, host is the address of Redis.

The following configuration file is a small example of what I do.

Input {

File {

Type = "Linux-syslog"

# wildcardswork, here:)

Path =>["/var/log/messages"]

}

}

Output {

Redis {

Data_type=> "List" key = "Test"

host = "localhost"

}

}

Start Logstash:java-jarlogstash-1.2.1-flatjar.jar agent-f Sample.conf–web

Logstash provides a web monitoring interface with the address: http://localhost:9292

At this point, Logstash can send the message update log file to Redis server, and the user can write a jar file themselves to read the Redis log, or use Logstash to read.

The following figure is the Logstash supported inputs, codecs, filters and outputs parameter configuration, you do not need to understand each, when needed to check it, the address is: http://logstash.net/docs/1.2.2/

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.