r/serverless • • Aug 04 '20

Why You Should Never, Ever print() in a Lambda Function

https://medium.com/@psingman/why-you-should-never-ever-print-in-a-lambda-function-f997d684a705
5 Upvotes

10 comments sorted by

1

u/incongruous_narrator Sep 07 '20

Nice article, on thanks! Would you happen to know how common is it to use elastic for lambda logs?

1

u/twopairisgood Sep 07 '20

Happy to hear the article was useful! I believe it's fairly common to forward Cloudwatch logs to a SumoLogic, Elastic, Splunk, or other log analyzer service. Most established companies have a centralized logging system in place before they adopted Lambda, so it would make sense to pipe a Lambda's output there as well.

1

u/incongruous_narrator Sep 08 '20

Right.. For centralized logging , assuming elastic is the logging solution, either lambda could directly write to elastic, or there could be a system that forwards cloudwatch logs elastic. What do you think is a better model?

2

u/twopairisgood Sep 09 '20

Based on what I've seen in only one situation, the devops team at my company had a log-forwarding lambda system. Either could work, I suppose with forwarding you could more easily batch requests and potentially save on costs.

Let me know if you go down either route!

1

u/incongruous_narrator Sep 09 '20

Yeah, that’s what I would prefer as well, because we keep the application independent of logging overhead in that case. I’ll let you know how it goes!

2

u/[deleted] Aug 04 '20

[removed] — view removed comment

1

u/twopairisgood Aug 08 '20

Lol this cuts deep.

I'll try to be conscientious of tone in the future.

1

u/[deleted] Aug 09 '20

[removed] — view removed comment

1

u/twopairisgood Aug 12 '20

Hah that's fair, glad to hear it was useful.

As a side note, it is funny to me how intentionally polite and conflict-avoiding people are with co-workers at least to their face (unless you either get really comfortable or really dislike them).

I say this just because I've been used to that for a while, it's a small shock when you start publishing online and people drop all pretense.