ES를 이용한 Rails 로그 분석 시스템 세팅
로그 분석 시스템 세팅 관련 ES를 이용한 로그 분석 시스템 세팅 과정 1. 서버에 td_agent 설치 다운로드 Fluentd plugin 설치 $ /usr/sbin/td-agent-gem install elasticsearch excon minitest rake test-unit webmock fluentd fluent-plugin-elasticsearch $ /usr/sbin/td-agent-gem install elasticsearch excon minitest rake test-unit webmock fluentd fluent-plugin-elasticsearch' 2. 서버에 ElasticSearch 설치 CentOS 설치 3. 레일즈 프로젝트에 lograge 설정 Gemfile에 lograge 추가 lograge 젬 설치 lograge 설정 ({project_path}/config/initializers/lograge.rb) config = WheelAdmin::Application.config # lograge : 로그를 특정 기간동안으로 잘라서 기록 config.lograge.enabled = true # 기본 rails 로그도 남겨 놓도록 설정 config.lograge.keep_original_rails_log = true # lograge 결과 파일명 config.lograge.logger = ActiveSupport::Logger.new "#{Rails.root}/log/lograge_#{Rails.env}.log" # json 으로 로그 남기도록 formatting module LogrageFormatter module_function def call(data) result = data.inject({}) { |h, (k, v)| h[k] = v; h } result.to_json end end # lograge 에 jso