Skip to content

Instantly share code, notes, and snippets.

@nowlinuxing
Created January 25, 2015 09:55
Show Gist options
  • Save nowlinuxing/d452360748f3da54569a to your computer and use it in GitHub Desktop.
Save nowlinuxing/d452360748f3da54569a to your computer and use it in GitHub Desktop.
Fluentd on Mac OS X
  1. Installation
  • Download DMG
  • Launch
    • sudo launchctl load /Library/LaunchDaemons/td-agent.plist
      • less /var/log/td-agent/td-agent.log
  • Post Sample Log
    • curl -X POST -d 'json={"json":"message"}' http://localhost:8888/debug.test
  • Send to S3
    # /etc/td-agent/td-agent.conf
    <match myapp.**>
      type s3
      aws_key_id KEY
      aws_sec_key SEC_KEY
      s3_bucket backet-name
      s3_endpoint s3-ap-northeast-1.amazonaws.com
      path logs/
      buffer_path /var/log/td-agent/bank
      
      time_slice_format %Y%m%d%H
      time_slice_wait 10m
      flush_interval 5s  # for debug
      utc
      
      buffer_chunk_limit 256m
      store_as json
    </match>
    
    launchctl unload /Library/LaunchDaemons/td-agent.plist launchctl load /Library/LaunchDaemons/td-agent.plist
  1. Send log from Rails app
  • log = Fluent::Logger::FluentLogger.new("myapp", host: "localhost", port: 24224) log.post("myaction", foo: :bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment