• Stars
    star
    185
  • Rank 208,271 (Top 5 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Replacing Elasticsearch with Rust and SQLite

Build Status

rrinlog

rrinlog is my attempt at Replacing Elasticsearch with Rust and SQLite for my nginx access logs, as Elasticsearch is a resource hungry application even at idle. rrinlog's success has been outstanding, with a 100x reduction in memory, 1000x reduction in CPU usage, and 100x reduction in disk usage.

This project contains two binaries:

  • rrinlog is for consuming nginx acces logs and storing them in a SQLite database. This binary may be built on Rust stable.
  • rrinlog-server exposes this SQLite database according to Grafana's JSON API datasource. This binary requires Rust nightly. Current Rust web framework is actix web, but there is a Rocket branch as well

This project currently isn't meant at replacing Elasticsearch for the general populous for the following reasons:

Custon Nginx Access Log

rrinlog ingests a custom nginx access log format:

log_format vhost    '$remote_addr - $remote_user [$time_local] '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent" "$host"';

Any other format would likely result in parsing errors.

Hardcoded SQL Queries

rrinlog-server let's me know what my top blog articles with the following SQL query:

SELECT referer,
       Count(*) AS views
FROM   logs
WHERE  host = 'comments.nbsoftsolutions.com'
       AND method = 'GET'
       AND path <> '/js/embed.min.js'
       AND epoch >= ?
       AND epoch < ?
       AND referer <> '-'
       AND remote_addr <> ?
GROUP  BY referer
ORDER  BY views DESC

This SQL query is tailored to me and how my blog is setup, so make no mistake that the intended audience with this query is solely me 😄

Limited Endpoints

These hardcoded SQL queries are needed as Grafana doesn't support SQLite as a native datasource. One day it may be supported like Mysql and Postgres, but until that day, rrinlog-server contains only a limited set of visualizations:

  • What are my top blog articles
  • How much outbound web data is leaving the server to other external IPs
  • How many requests are being serviced by other virtual hosts

No GeoIP Capabilities

Elasticsearch has the ability to take an IP address and turn it into a location. This is called GeoIP. I had a Grafana panel showing the top visiting cities, which is novel but not critical to monitor. Migrating from Elasticsearch meant I had to remove the visualization.

More Repositories

1

OhmGraphite

Expose hardware sensor data to Graphite / InfluxDB / Prometheus / Postgres / Timescaledb
C#
402
star
2

highway-rs

Native Rust port of Google's HighwayHash, which makes use of SIMD instructions for a fast and strong hash function
Rust
146
star
3

dness

A dynamic dns client
Rust
114
star
4

Pfim

.NET Standard targa (.tga) and direct draw surface (.dds) image decoder
C#
107
star
5

boxcars

Rocket League Replay parser in Rust
Rust
99
star
6

jomini

Parses Paradox files into javascript objects
TypeScript
76
star
7

bitter

Extract bits from a byte slice
Rust
70
star
8

Farmhash.Sharp

Port of Google's farmhash algorithm to .NET
C#
62
star
9

bottle-ssl

A simple web page using BottlePy and SSL
Python
56
star
10

rrrocket

Rocket League Replay parser to JSON -- CLI app
Rust
53
star
11

Pdoxcl2Sharp

A Paradox Interactive general file parser
C#
39
star
12

highwayhasher

HighwayHash implementation for node and browsers
TypeScript
34
star
13

collectd-rust-plugin

Write a low-cost, ergonomic plugin for collectd
Rust
28
star
14

EU4.Savegame

Web application to generate statistics based on EU4 savegames
C#
13
star
15

pg-collectd

An alternative and opinionated postgres collectd writer
Rust
13
star
16

rl-web

Online Rocket League Replay Parser
TypeScript
12
star
17

Pfarah

Parses files generated by the Clausewitz engine
F#
7
star
18

eecs381-lint

Additional style checks for C/C++ for clang-tidy
C++
6
star
19

dropwizard-hikaricp-benchmark

Dropwizard with HikariCP DB Connection Pool Benchmarks
Java
6
star
20

next.js-wasm-worker

Bug repro
JavaScript
4
star
21

register

Digesting and Distilling Federal Register data
XQuery
4
star
22

HighPerformanceUnsafeCSharp

The many different ways to accomplish the same task, often using unsafe constructs.
C#
3
star
23

bench

Benchmarking Wasm for insight and troubleshooting
TypeScript
2
star
24

eu4save

Parses and provides methods for viewing an eu4 save
JavaScript
1
star
25

hhsum

Calculate checksums of files using HighwayHash
Rust
1
star
26

vigenere

Recover vigenere ciphertext using frequency analysis
TypeScript
1
star