logstashlog4r

How to configure log4r for logstash


Someone please show me an example of log4r configuration for sending logs to logstash. My rails application lies in a remote server.

Also logstash configuration for recieving log4r logs.

Thanks in Advance


Solution

  • I'd suggest you to use filebeat. A tool by the creators of logstash that allow you to send logs from one server to another with logstash or elasticsearch. The application is very lightweight and simple to configure.

    Here is an example configuration that sends the content of /path/to/your/logfile.log to a logstash server name logstashserver:

    filebeat:
      prospectors:
        -
          paths:
            - /path/to/your/logfile.log
          input_type: log
      registry_file: /var/lib/filebeat/registry
    
    output:
      logstash:
        hosts: ["logstashserver:5043"]
    
    shipper:
    logging:
      files:
        rotateeverybytes: 10485760 # = 10MB
    

    If you need a more comprehensive guide check this link

    Greetings,