Live data from Hacker News

Ask HN: How do you manage logs for your backend services?

news.ycombinator.com

41–50 of 142 posts

Re: Ask HN: How do you manage logs for your backend services?

#41
We used to use an ELK cluster but it was always breaking - I'm sure this stuff can be reliable but we just wanted an easy way to search ~300GB of logs (10GB/day)

Somehow I came across scalyr and it's just phenomenally fast - and cost less than our ELK cluster. Definitely worth trying if it provides the features you need.

Re: Ask HN: How do you manage logs for your backend services?

#42

People jumped to recommending things before asking: What's the volume of logs? What's the expected usage? (debugging? audit?) Are you using text, or structured logs? (or can you switch to structured easily?) How far back do you want to keep the logs? How far back do you want to query them easily? Are you in an environment with an existing simple solution? (GCP, AWS)

Well the question in the title was how do you manage your logs, so people are answering.

Re: Ask HN: How do you manage logs for your backend services?

#43
If you haven't read the chapter of 12factor on logging I highly recommend it https://www.12factor.net/logs

This is coming from an ops person, do that and I'll be happy. Essentially the goal is to externalize all your log routing to stdout, then wrap tooling around your application to route it wherever you want it to go. It's geared toward heroku but same rules apply in docker land and more traditional VM environments.

We either send logs ECS -> Cloudwatch for our AWS stuff or docker swarm -> fluentd -> s3 for an onsite appliance (also anything syslog ends up in Sumologic through a collector we host in the environment). From there the logs get consumed by our SIEM (in our case Sumologic, which is a great service). We keep logs hot for 90 days and ship archives back to s3 for a year. Set up the lifecycle management stuff, keeping log files forever is not only a waste but can actively hurt you if they ever get exposed in a breach.

I highly recommend formatting your logs JSON (even if you have to do it by hand like in Apache). If you do that and go to Splunk, Sumologic, or ELK all your fields will be populated either automatically or with a single filter. Saves writing or buying your own and if you add a field there's no action for you to take.

nginx/apache default logging is complete trash. Look at the variables they expose, there's a lot of stuff in there you'll want to add to the log format to make your life loads easier. I have a format I use I'd be willing to send you if you want it.

I don't recommend logstash (the L in ELK), ever (except maybe if you're java across the board). It's way too damn heavy to run on a workload host, fluentd is much lighter (and not java, why would I deploy java for a system tool ever?). Maybe as a network collector you throw syslog at but that would be it.

For your use case Sumologics free service would be great. You can get I think up to 200m a day with a weeks retention for free and you'll get exposed to what an SIEM can do for you (ingestion rate and retention period are typically how hosted solutions are billed, you'll need email with any non-free email domain to get a free account from them). IMO you have to get to some fairly insane log rates for me to ever recommend running ELK stack yourself, it has way too much care and feeding if you want to run it correctly with good security.

Re: Ask HN: How do you manage logs for your backend services?

#44

We used to use an ELK cluster but it was always breaking - I'm sure this stuff can be reliable but we just wanted an easy way to search ~300GB of logs (10GB/day) Somehow I came across scalyr and it's just phenomenally fast - and cost less than our ELK cluster. Definitely worth trying if it provides the features you need.

ELK has way too much care and feeding for it to be worth it until your log ingestion rates start to get crazy.

Re: Ask HN: How do you manage logs for your backend services?

#45
post #39

We used Sumologic for a long time and still do. You can query your logs in an SQL-way (you can do joins for instance) and last I checked they have a free tier.

Their ability to figure out json for mostly-but-not-entirely json log records in the query line as well as LogReduce and LogCompare are great. Hot take, they're way better than Splunk.

Re: Ask HN: How do you manage logs for your backend services?

#46

Nobody mentioning Splunk? Too obvious or am I not understanding the ask?

I don't recommend Splunk because I don't want someone recommending we run Splunk onsite ever again.

Running your own log infrastructure is the absolute worst. As in, we had to put a staff devops engineer on just that for 2 months the last time the company I was at needed an upgrade.

Re: Ask HN: How do you manage logs for your backend services?

#47

People jumped to recommending things before asking: What's the volume of logs? What's the expected usage? (debugging? audit?) Are you using text, or structured logs? (or can you switch to structured easily?) How far back do you want to keep the logs? How far back do you want to query them easily? Are you in an environment with an existing simple solution? (GCP, AWS)

Well the question in the title was how do you manage your logs, so people are answering.

One should always read beyond the title. The actual request was for advice on what tusharsoni was thinking of doing.

Re: Ask HN: How do you manage logs for your backend services?

#48

People jumped to recommending things before asking: What's the volume of logs? What's the expected usage? (debugging? audit?) Are you using text, or structured logs? (or can you switch to structured easily?) How far back do you want to keep the logs? How far back do you want to query them easily? Are you in an environment with an existing simple solution? (GCP, AWS)

Well the question in the title was how do you manage your logs, so people are answering.

I'm cool with the answers about what people are actually using. But there are also recommendations, and that's what OP asked for at the end.

Re: Ask HN: How do you manage logs for your backend services?

#49
ELK is expensive, in terms of hardware and time to configure/manage. But it does scale to large volumes in a way that your current ad hoc 1970s logging will not.

I had a good experience with a local decentralized logging system, essentially daemontools-style service logs, that then fed in to ELK. ELK provided the bulk storage and analysis; and the local daemontools logs provided the immediate on-machine per-individual-service recent log access, and decoupled logging from the network connection to logstash.

* http://jdebp.uk./Softwares/nosh/guide/commands/export-to-rsy...

* http://jdebp.uk./Softwares/nosh/guide/commands/follow-log-di...

One of the advantages of this approach is that one can do the daemontools-style logging first, very simply, without centralization, and with comparatively minor expense; and then tack on ELK later, when volume or number of services gets large enough, without having to alter the daemontools-style logging when doing so.

Of course, it can be something else other than ELK, fed from the daemontools-style logs.

One thing that I recommend against, ELK or no, is laboriously re-treading the path of the late 1970s and the 1980s, starting from that "logging straight to a file". Skip straight through to the 1990s. (-:

* http://jdebp.uk./FGA/do-not-use-logrotate.html

Re: Ask HN: How do you manage logs for your backend services?

#50
I was just about to start looking into doing this myself and for the foreseeable future, I'll probably just use `dsh`... since I'm a cheapskate, have been trying to reduce my usage on cloud tools, and I just found out about it today:

https://www.netfort.gr.jp/~dancer/software/dsh.html.en

Once installed, change the default from rsh to ssh where it's installed e.g. `/usr/local/Cellar/dsh/0.25.10/etc/dsh.conf`

Then setup a group for machines, in this case I'm calling it "web"

> mkdir -p .dsh/group

> echo "some-domain-or-ip" >> .dsh/group/web

> echo "some-domain-or-ip-2" >> .dsh/group/web

Then fire off a command:

> dsh -M -g web -c -- tail -f /var/log/nginx/access.log

> some-domain-or-ip [... log message here ...]

> some-domain-or-ip-2 [... log message here ...]

The flags I used are:

-M "Show machine name"

-g "group to use"

-c run concurrently

That's about as easy as I can think of... /shrug while I like the idea of centralized logging services I haven't really found one I actually cared for... most just run rampant with noise, slow UIs, and strange query languages no one wants to learn. I guess I could start a machine up with `dsh` on it in my cluster and then write the output from dsh to a file... easy centralized logging on the cheap, ha!

Post reply on HN