Show HN: Log collector that runs on a $4 VPS (github.com)
Hey guys, I'm building erlog to try and solve problems with logging. While trying to add logs to my application, I couldn't find any lightweight log platform which was easy to set up without adding tons of dependencies to my code, or configuring 10,000 files.
ErLog is just a simple go web server which batch inserts json logs into an sqlite3 server. Through tuning sqlite3 and batching inserts, I find I can get around 8k log insertions/sec which is fast enough for small projects.
This is just an MVP, and I plan to add more features once I talk to users. If anyone has any problems with logging, feel free to leave a comment and I'd love to help you out.
63 comments
[ 2.5 ms ] story [ 143 ms ] threadhttps://www.hetzner.com/cloud
More like $5 but still, 1 vCPU, 2GB RAM, 20GB NVMe storage. Closer to $4 USD if you let go of IPv4 in favor of IPv6 only.
Edit: Looks like that's also a shared vCPU.
...so what you're saying they have to write "tail -F" instead of "tail".
> If you use grep you'll be doing the same expensive operation every time
if you have ingest that low it barely matters. Modern grep replacements are pretty fast
Try tools like Metabase and see how it makes your log reading far better.
I settled on a happy/ok midpoint recently whereby I dump logs in a redis queue using filebeat as it’s very simple. Then have a really simple queue consumer that dumps the logs into clickhouse using a schema Uber detailed (split keys and values), so queries can be pretty quick even over arbitrary fields. 30,00 logs an hour and I can normally search for anything in under a second.
It’s probably incredibly boring to describe, but I think that’s why it just tends to work. The whole thing took an afternoon to write (in PHP of all things too).
Do you use any particular UI/Frontend tool for querying these logs?
I've also considered Grafana, but it's not good for viewing raw logs.
I think LogQL + Grafana UI is a pretty rich/interactive experience of viewing logs v/s Metabase.
https://www.metabase.com/glossary/images/table/example-table...
than this brain crushing string spaghetti view any day.
https://grafana.com/static/img/docs/v64/logs-panel.png
I can easily colorize lines depending on log severity, filter by dates with a drop-down date selector UI, filter by each column value etc all in eye friendly manner.
https://pasteboard.co/PQDjUwtFgZTW.png
https://pasteboard.co/tfHHA1mgETvL.png
The gist of it is:
- Structured logs (json) are stored as kv pairs in parallel arrays, along side metadata (host, timestamp, id, geo, namespace, etc).
- Log fields (ie kv pairs) are materialized (indexed) depending on query patterns, and vaccummed up if unused.
- Authoring queries and Kibana dashboard support is not trivial but handled with a query translation layer.
Do you mean something like two arrays [k1, ..., kN] and [v1, ..., vN] in two different columns?
Is there a way in Clickhouse to filter such a pair of arrays such that you can do a search akin to vals[indexOfKey("foo")] == "bar"?
https://github.com/hamin/jlq
How did you come up with the idea for jlq? It seems like it solved a pretty cool use case.
That should tremendously improve throughput, at the expense of some latency.
https://www.elastic.co/guide/en/beats/filebeat/current/fileb...
https://vector.dev/docs/reference/vrl/
Free through '23 is my motto... Just a solo founder looking for feedback.
[1] https://log-store.com/
I have been beta testing it for a while for small scale (~50 million non-nested json objects) log aggregation it's working beautifully for this case.
It's a no nonsense solution that is seemless to integrate and operate. On the ops side, it's painless to setup, maintain, and push logs to. On the user side, its extremely fast and straight forward. End users are not fumbling their way through a monster UI like Kibana, access to information they need is straight forward and uncluttered.
I can't speak to it's suitability in a 1TB logs/day situation, but for a small scale straight forward log agg. tool I can't recommend it enough.
They have just added a new parser and query engine written in Rust to get the best performance out of your instance. https://news.ycombinator.com/item?id=34758674
It uses SQLite internally but can parse log files in many formats on the fly. C++, BSD license, discussed 1 month ago: https://news.ycombinator.com/item?id=34243520
If you have an old computer at home, using a VPS as the gateway is always a good option.
Edit: you can then use the VPS as a exit node for internet.
I mean, you can just log the trace/span/parent IDs for each request, but that's a bit painful to deal with later.
You can use S3 API to access Backblaze.
I'm not experienced with Hetzner Storage Box but I don't think that you can just attach it to your storage VM as fast storage. You can mount it as samba store but I think that's a recipe for disaster.