zshannon / cloudwatchlogger Goto Github PK
View Code? Open in Web Editor NEWRails compatible logger that sends events to AWS CloudWatchLogs
License: MIT License
Rails compatible logger that sends events to AWS CloudWatchLogs
License: MIT License
With the release 0.3.0, our apps started crashing there (looks like it's related to #12)
#<CloudWatchLogger::Client::AWS_SDK::DeliveryThread:0x000055d9d76eadf0@/usr/share/gems/gems/cloudwatchlogger-0.3.0/lib/cloudwatchlogger/client/aws_sdk/threaded.rb:49 run> terminated with exception (report_on_exception is true):
--
| /usr/share/gems/gems/cloudwatchlogger-0.3.0/lib/cloudwatchlogger/client/aws_sdk/threaded.rb:61:in `[]': no implicit conversion of Symbol into Integer (TypeError)
| from /usr/share/gems/gems/cloudwatchlogger-0.3.0/lib/cloudwatchlogger/client/aws_sdk/threaded.rb:61:in `block (2 levels) in initialize'
| from /usr/share/gems/gems/cloudwatchlogger-0.3.0/lib/cloudwatchlogger/client/aws_sdk/threaded.rb:50:in `loop'
| from /usr/share/gems/gems/cloudwatchlogger-0.3.0/lib/cloudwatchlogger/client/aws_sdk/threaded.rb:50:in `block in initialize'
Is it something new we have to set somewhere or is it a bug?
Hello!
According to a section in Readme, i should be able to convert hash to cloudwatch "tags". So using Rails.logger.info :boom => :box
should produce a x=y, z=q, boom=box
log entry. However, it produces a following entry:
So basically hash gets converted into a string and gets logged as a regular @message
. Am i doing something wrong? That's my first contact with CloudWatch as a rails logging provider so maybe i misunderstand something. Thanks in advance for any help!
Right now, this is how we configure the library:
log = CloudWatchLogger.new({access_key_id: 'YOUR_ACCESS_KEY_ID', secret_access_key: 'YOUR_SECRET_ACCESS_KEY'}, 'YOUR_CLOUDWATCH_LOG_GROUP')
This is far from ideal because:
The solution I see is introduce a configuration block, e.g.
CloudwatchLogger.configure do |config|
config.aws_key = xxx
config.aws_secret = xxx
config.log_group = xxxx
end
and have an instance of CloudwatchLogger saved into CloudwatchLogger.current
(pretty much like Redis gem is doing)
Ideas? Opinions?
I see DEBUG severity but my Rails 3.2 app as log_level :info
.
Initializing Cloudwatchlogger as follows:
l = CloudWatchLogger.new({access_key_id: '[redacted]', secret_access_key: '[redacted]'}, '/customer/main-site', 'stream-name', region: 'ap-northeast-1')
seems to ignore the credentials provided to the initializer and instead use the ones in ~/.aws/credentials.
In Client#formatter
, there is a conditional that checks if @format = :json && msg.is_a?(Hash)
. If this is true, the message is logged as a JSON object, otherwise it is logged as a string.
There currently does not seem to be a way to set @format
so the log is always a string. This means the CloudWatch "Discovered Fields" feature does not discover the keys within the JSON object.
Hi big fan of the gem but due to the volume of logs I need to fit more information onto the first line of the log as shown in cloudwatch. As cloudwatch already logs the time and the other automatic fields are not useful to the information I want to log I was hoping there was a way to turn them off?
many thanks,
Simon
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.