Sha256: c4eada2917f0811c1d2aa7dda2819b23652e6df5495de5da63de531a327c1dd4
Contents?: true
Size: 1.81 KB
Versions: 12
Compression:
Stored size: 1.81 KB
Contents
# -*- mode: org; auto-fill-mode -*- #+TITLE: Setting up Fluentd #+startup: showeverything * Introduction The following will setup and configure ~fluentd~ on a node. * Setup :setup: Fluentd can be installed either as a package from treasure data or just as a gem. In this example, we only install as a gem: # Fails because of permissions #+name: install_fluentd #+begin_src sh :shebang #!/bin/bash :before all gem list | grep fluentd fluentd_installed=$? if [ $fluentd_installed -ne 0 ]; then echo "Installing fluentd..."; gem install fluentd fi gem list | grep fluent-logger fluentd_logger_installed=$? if [ $fluentd_logger_installed -ne 0 ]; then echo "Installing fluent-logger for Ruby..."; gem install fluent-logger fi #+end_src * Configuration :config: Set Fluentd to listen on the ~fluentd_port~ port and to write logs to ~fluentd_filepath~. #+begin_src conf :tangle fluentd.conf <source> type forward port 4224 </source> <match **> type file path here.log flush_interval 0s </match> #+end_src # A script to daemonize the process could be written here, as well as # any /etc/default/* required settings... * Flusher Send some logs: #+name: flush_logs #+begin_src ruby :shebang #!/usr/local/bin/ruby require 'fluent-logger' sleep 2 # Wait for fluentd to start at the beginning Fluent::Logger::FluentLogger.open(nil, :host => 'localhost', :port => 4224) 100.times do |n| Fluent::Logger.post("myapp.access", {"agent"=>"foo - #{n}"}) sleep 0.1 end #+end_src * Tailer And yet another process which will be tailing the file that we are sending logs too: #+name: tail_logs #+begin_src sh :shebang #!/bin/bash tail -f here.* #+end_src * Start which was configured here :start: #+name: fluentd_run #+begin_src bash :shebang #!/bin/bash fluentd -c fluentd.conf -vvv #+end_src
Version data entries
12 entries across 12 versions & 1 rubygems