-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add way to disable stringification step? #71
Comments
I'm looking into an implementation for this. Looking at clojure.tools.logging, it seems the Also I wonder, what is the purpose of the msg-type [1] https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging.clj#L81 |
Hi Jeroen, Sorry for the delay getting back to you - was away on vacation + intentionally trying to avoid non-critical work while the opportunity was there :-).
Understood. The formatting stuff is provided as a convenience since it's often what folks want, but it's entirely optional. Appenders will also receive all raw (unstringified) arguments under the For future reference (for example, in case I'm not able to get back to you quickly) - this kind of stuff is (mostly) documented under the
If I recall correctly, tools.logging actually does stringification only (i.e. no raw args are provided).
To clarify:
Just to cut down on the unnecessary aliases:
Good question. That's for when you don't want any auto stringification, for example because you're intending to use the raw Does that help? Feel free to ping if you've got any other questions. Cheers! :-) |
No worries! Thanks for giving this amount of support!
Sounds reasonable. I have two more questions. The code mentions So I will :nil and use :args, but I'll have to write my own version of the Thanks again for the support! |
Yes, that's right. You shouldn't need
The So only the appender needs a modification.
Or I'd suggest contacting the author of socket-rocket. I'm not familiar with Logstash but if what you want to do is a common thing, it may be convenient to have it as a built-in option to socket-rocket.
I'd say just specialized cases where you have very high performance requirements and you want to avoid unnecessary auto-stringification. I wouldn't worry about this at all. Cheers! :-) |
So I wasn't really clear indeed, the main reason I don't want the stringification is because I have very high performance requirements :-) I saw using We're receiving more than 50k QPS and I only want to log a small sample of it. I'm using the rate-limiting feature to stop sending too many messages, but with the rate limiting the stringification is still applied. In my case it is a rather big clojure map, so it will definitely impact performance. Maybe I should wrap the log statement with my own sampling function so it doesn't matter. It feels though that the disabling of the auto-stringification wouldn't be a big addition, but you are a better judge. I'll post a link to gist later to show you what I have done to get a better idea. I'll will also contact the socket-rocket author to discuss alternatives. Thanks! |
Okay, I'm with you. Will look through this again next time I'm in the Timbre code. It may be possible, for example, to wrap the stringification stuff in a delay so that appenders don't need to pay the stringification cost when they don't need the stringification.
I guess that'd depend mostly on whether you want comprehensive or sampled logging though (i.e. aside from the performance concerns). Note that there's a
Cool! |
Okay, have added a note about delay-wrapping the stringified The approach you're taking in the meantime sounds good to me. Closing this, feel free to reopen if you have any further comments/questions. Cheers! :-) |
…age`+`:output` keys
I'm using socket-rocket, a timbre appender for Logstash, and log-config to send certain tagged log messages to Logstash. This is working nicely for simple log statements like:
With Logstash it can be useful to log nested structures, however, this doesn't seem to be possible in the current setup:
In this case I would like to disable the formatting completely and just use identity for the log message. The socket-rocket appender would then generate proper JSON. It would require a third option to this part I presume.
Am I missing something and is this already possible? Or otherwise, do you think it is a good idea to have the ability to disable formatting?
Thanks,
Jeroen
The text was updated successfully, but these errors were encountered: