r/devops7 • • Nov 03 '26

Automate it #4: "disk full in N days" from one SQL query, plus the check that catches a box that started filling 16x faster today (real output)

1 Upvotes

A 90% disk alert fires too late to do anything calm about it. A trend line ("full in 27 days") is better, but it is slow: the morning someone leaves DEBUG logging on, a 14-day trend still says you have two months.

So this daily job does two things with one table of df samples:

  1. Trend: least-squares slope over the last 14 days, so you get "full in N days" per server.
  2. Odd day: scores today's growth against what each server usually does, and flags the box that is suddenly filling much faster than normal, before the trend notices.

(Disclosure: this sub is run by the SynapCores team, and step 2 uses SynapCores. Run this morning on 2.3.2, real output.)

Collect: one line per server per day

for h in web-01 db-01 app-02 cache-01 logs-01; do
  ssh $h "df -P /" | awk -v h=$h -v d=$(date +%F) 'NR==2{print d, h, $6, $5+0}'
done | python3 disk_trend.py ingest

That prints 2026-11-03 web-01 / 62 lines. The script stores each one with today's growth, the server's usual growth (its 14-day average) and the difference:

CREATE TABLE disk_samples (day TEXT, host TEXT, mount TEXT, used_pct REAL, growth REAL, usual REAL, excess REAL);

For this post: 30 days of samples for 5 test servers (seeded generator in the first comment, so you can reproduce every number). On the last day, logs-01 gets a DEBUG-logging spike.

Step 1, the trend: plain SQL, nothing special

SELECT s.host, s.mount, MAX(t.used_pct) AS used,
       (COUNT(*)*SUM(s.n*s.used_pct) - SUM(s.n)*SUM(s.used_pct)) / (COUNT(*)*SUM(s.n*s.n) - SUM(s.n)*SUM(s.n)) AS slope
FROM (SELECT host, mount, used_pct, DATEDIFF(day, '2026-11-03') AS n FROM disk_samples
      WHERE DATEDIFF(day, '2026-11-03') > -14) s
JOIN disk_samples t ON t.host = s.host AND t.mount = s.mount AND t.day = '2026-11-03'
GROUP BY s.host, s.mount;

Then (100 - used) / slope in Python is the days left. Here is every server:

TREND cache-01  /  33.3% used, +0.10/day -> full in 643 days
TREND db-01     /  78.1% used, +0.80/day -> full in 27 days
TREND logs-01   /  64.6% used, +0.54/day -> full in 66 days
TREND web-01    /  62.2% used, +0.24/day -> full in 159 days

db-01 is the one to plan for. logs-01 looks fine: 66 days.

Step 2, the odd day: an anomaly model in the database, scored inside the SELECT

Every morning, retrain on the last 30 days (the whole report runs in under 0.1 s for 150 rows), then score today:

CREATE EXPERIMENT disk_growth_exp AS
  SELECT excess FROM disk_samples WHERE DATEDIFF('2026-11-03', day) <= 30
WITH (task_type = 'anomaly_detection', algorithms = ['isolation_forest'], max_trials = 5, random_seed = 42);
DEPLOY MODEL disk_growth_model FROM EXPERIMENT disk_growth_exp;

SELECT host, mount, used_pct, growth, usual, ANOMALY_SCORE('disk_growth_model', excess) AS score
FROM disk_samples WHERE day = '2026-11-03' AND ANOMALY_SCORE('disk_growth_model', excess) > 0.8;

No labels and no per-server thresholds. "Weird" is learned from 30 days of what your fleet normally does, and excess (today minus usual) keeps a fast-growing DB from looking weird just for being busy.

Run it

Yesterday's run, before the spike:

$ python3 disk_trend.py report 2026-11-02
TREND db-01     /  77.2% used, +0.79/day -> full in 29 days

This morning:

$ python3 disk_trend.py report 2026-11-03
TREND db-01     /  78.1% used, +0.80/day -> full in 27 days
ODD   logs-01   /  +6.1 pts today, usually +0.37 (anomaly 0.91) -> at today's rate full in 6 days

The trend still says logs-01 has 66 days. The anomaly score says something changed today, and at today's rate it has 6. The top 5 scores over all 150 server-days:

logs-01   2026-11-03   +6.1   usual 0.37   0.91
db-01     2026-10-06   +1.0   usual 0.00   0.79
cache-01  2026-10-09   -0.3   usual 0.23   0.75
cache-01  2026-10-12   -0.3   usual 0.11   0.67
logs-01   2026-10-06   +0.5   usual 0.00   0.66

The spike is alone above 0.8. db-01 grew +0.9 today, like most days, and scores 0.37: busy, not odd.

Wire it up: 30 7 * * * collect.sh && python3 disk_trend.py report $(date +%F) | grep -E 'TREND|ODD', then send that to Slack. TREND lines are for the weekly capacity chat, ODD lines are for today. Full disk_trend.py (about 50 lines, stdlib only) and the sample generator are in the first comment.

Update: inodes. A reader pointed out that inodes can run out long before the disk percentage looks scary. No second table needed: collect df -Pi as its own "mount", and both checks run unchanged, because everything groups by host + mount:

ssh $h "df -Pi /" | awk -v h=$h -v d=$(date +%F) 'NR==2{print d, h, $6":inodes", $5+0}'

Same seeded fleet on 2.3.2, plus an app-02 that sits at ~41% disk but uses ~1.1% of its inodes a day (lots of tiny cache files). Generator for that, so you can reproduce it:

import random, datetime
random.seed(11)
start, u = datetime.date(2026, 10, 5), 52.0
for d in range(30):
    if d: u += max(0.0, random.gauss(1.1, 0.15))
    print((start + datetime.timedelta(days=d)).isoformat(), "app-02", "/:inodes", round(u, 1))

Output:

$ WARN_DAYS=60 python3 disk_trend.py report 2026-11-03
TREND app-02    /:inodes  84.1% used, +1.10/day -> full in 14 days
TREND db-01     /  78.1% used, +0.80/day -> full in 27 days
ODD   logs-01   /  +6.1 pts today, usually +0.37 (anomaly 0.91) -> at today's rate full in 6 days

app-02's disk line never shows up (it has years left), but its inodes run out in two weeks.

Free Community Edition: https://synapcores.com/download?utm_source=reddit&utm_medium=owned&utm_campaign=devops7-automate-it-4

What filled up a disk on you the fastest: logs, core dumps, Docker images, or something stranger?


r/devops7 • • Nov 02 '26

One script, one chore: send each alert to the team that owns it, matched by meaning (no regex routing rules, ~25 lines of Python)

1 Upvotes

Alert routing usually starts as a few regex rules (/postgres|pg-/ -> #db-oncall) and ends as 200 of them that nobody dares to touch. Every new tool phrases things its own way, so the rules never cover the alert that actually wakes you up, and it lands in the wrong channel.

The chore: write one sentence per team saying what they own, and send each alert to the team whose sentence is closest in meaning. If nothing is close, send it to a triage channel instead of guessing.

(Disclosure: this sub is run by the SynapCores team, and the matching step below uses SynapCores. Tested on 2.3.2 this morning.)

Setup, once: one row per team

CREATE TABLE team_owners (team TEXT PRIMARY KEY, channel TEXT, owns TEXT, embedding VECTOR(384));
INSERT INTO team_owners (team, channel, owns) VALUES
 ('database', '#db-oncall', 'Postgres primary and replicas, replication lag, slow queries, connection pool exhaustion, vacuum'),
 ('platform', '#platform-oncall', 'Kubernetes nodes and pods, container restarts, memory limits, disk space on hosts, autoscaling'),
 ('network', '#net-oncall', 'load balancers, DNS resolution, TLS certificates, ingress, packet loss, VPN'),
 ('payments', '#payments-oncall', 'checkout API, card authorization failures, payment provider webhooks, refunds');
UPDATE team_owners SET embedding = EMBED(owns);

CREATE TABLE incoming_alerts (id INTEGER PRIMARY KEY, alert TEXT, embedding VECTOR(384));

EMBED() runs a small embedding model inside the database and stores what each sentence means as 384 numbers. No API key, nothing leaves the box.

The script: route_alerts.py

alerts = [line.strip() for line in open(sys.argv[1]) if line.strip()]
sql("DELETE FROM incoming_alerts")
sql("INSERT INTO incoming_alerts (id, alert) VALUES " + ", ".join(f"({i}, {quote(a)})" for i, a in enumerate(alerts, 1)))
sql("UPDATE incoming_alerts SET embedding = EMBED(alert)")
rows = sql("""SELECT a.id, a.alert, t.channel, COSINE_SIMILARITY(a.embedding, t.embedding) AS score
              FROM incoming_alerts a, team_owners t ORDER BY a.id, score DESC""")
best = {}
for i, alert, channel, score in rows:
    best.setdefault(i, (alert, channel, score))
for alert, channel, score in best.values():
    if score < 0.3:
        channel = "#ops-triage"
    print(f"{channel:<17} {score:.2f}  {alert}")

(The sql() and quote() helpers are 8 lines; they're in the first comment.)

Run it on this morning's 7 alerts

$ python3 route_alerts.py alerts.txt
#db-oncall        0.67  pg-replica-2 is 340s behind primary
#platform-oncall  0.51  pod api-7f9c restarted 6 times in 10 min (CrashLoopBackOff)
#ops-triage       0.21  NXDOMAIN for internal.api.svc from 3 resolvers
#payments-oncall  0.58  stripe webhook deliveries failing with 401 since 09:12
#platform-oncall  0.59  node ip-10-0-3-17 disk 94% full on /var/lib/kubelet
#db-oncall        0.39  too many clients already: pool at 200/200 on db-primary
#ops-triage       0.12  marketing site hero image returns 404

Look at too many clients already: pool at 200/200. It never says "Postgres" or "connection", and CrashLoopBackOff never says "container restarts", yet both land with the right team. The marketing 404 matches nobody (0.12), so it goes to triage instead of waking the payments on-call.

When triage gets one that has an owner, teach the owner's sentence

The NXDOMAIN alert was closest to network (0.21) but under the 0.3 cut, so it went to triage. That's the safe default. Once a human says "that's network", add the words:

UPDATE team_owners SET owns = owns || ', NXDOMAIN and resolver errors' WHERE team = 'network';
UPDATE team_owners SET embedding = EMBED(owns) WHERE team = 'network';

Re-run:

#net-oncall       0.40  NXDOMAIN for internal.api.svc from 3 resolvers
#ops-triage       0.12  marketing site hero image returns 404

One edit to a sentence instead of a new regex, and the other six routes stay the same. Pick your cut-off from a week of real alerts: the scores of correct routes here run 0.39–0.67 and the non-matches 0.12–0.21.

Free Community Edition if you want to try it: https://synapcores.com/download?utm_source=reddit&utm_medium=owned&utm_campaign=devops7-route-alerts

What's the alert that most often ends up in the wrong channel on your team?


r/devops7 • • Oct 30 '26

What broke this week? Drop a one-liner. (Plus how we check each new incident against old ones by meaning, so repeats come with their old fix)

1 Upvotes

Friday thread. What broke for you this week? One line is plenty: what failed, and what fixed it (or "still don't know").

A lot of "new" incidents are repeats of something someone already fixed, just described differently. "Build servers ran out of disk space" and "docker host filled up with old images" are the same problem, but grep won't connect them. So we keep a small incident notebook and match each new one against it by meaning.

(Disclosure: this sub is run by the SynapCores team, and the matching step uses SynapCores. Run this morning on 2.3.2, real output.)

The notebook: past incidents and what fixed them

CREATE TABLE incidents (id INTEGER PRIMARY KEY, happened TEXT, what_broke TEXT, fix TEXT, embedding VECTOR(384));
INSERT INTO incidents (id, happened, what_broke, fix) VALUES
 (1, '2026-08-14', 'cron job silently stopped after the server moved to UTC', 'pin TZ in the crontab and alert on missed runs'),
 (2, '2026-09-02', 'postgres ran out of connections during a traffic spike, app got connection errors', 'put pgbouncer in front, cap the app pool at 20'),
 (3, '2026-09-19', 'docker host ran out of disk space, old images filled it up', 'weekly docker image prune -a --filter until=168h'),
 (4, '2026-10-03', 'expired TLS cert on the internal API', 'certbot renew + daily expiry check'),
 (5, '2026-10-11', 'deploy went out with a missing env var and the app crash-looped', 'validate required env vars in CI before deploy');
UPDATE incidents SET embedding = EMBED(what_broke);

This week's one-liners, in whatever words people used

CREATE TABLE this_week (id INTEGER PRIMARY KEY, reply TEXT, embedding VECTOR(384));
INSERT INTO this_week (id, reply) VALUES
 (1, 'our build servers ran out of disk space again'),
 (2, 'the database hit max connections when traffic jumped after the newsletter'),
 (3, 'the nightly report job never ran after the clocks changed'),
 (4, 'someone rotated the S3 keys and forgot the backup script');
UPDATE this_week SET embedding = EMBED(reply);

Seen it before? Show the old fix

SELECT w.reply, i.happened, i.fix,
       ROUND(COSINE_SIMILARITY(w.embedding, i.embedding), 2) AS match
FROM this_week w CROSS JOIN incidents i
WHERE COSINE_SIMILARITY(w.embedding, i.embedding) > 0.4
ORDER BY w.id;

our build servers ran out of disk space again
    2026-09-19  weekly docker image prune -a --filter until=168h  0.51
the database hit max connections when traffic jumped after the newsletter
    2026-09-02  put pgbouncer in front, cap the app pool at 20    0.51
the nightly report job never ran after the clocks changed
    2026-08-14  pin TZ in the crontab and alert on missed runs    0.49

The wording differs from the old write-ups ("clocks changed" vs "moved to UTC", "build servers" vs "docker host"), and each one still lands on the right fix. Every wrong pairing scored 0.27 or lower.

Genuinely new? That's the one worth a postmortem

SELECT w.reply, ROUND(MAX(COSINE_SIMILARITY(w.embedding, i.embedding)), 2) AS best
FROM this_week w CROSS JOIN incidents i
GROUP BY w.reply
HAVING MAX(COSINE_SIMILARITY(w.embedding, i.embedding)) < 0.4;

someone rotated the S3 keys and forgot the backup script   0.2

So the Friday routine is: three repeats get their old fix pasted into the ticket, and one new incident gets written up and added to the notebook. Next time it'll match too.

If you want to try it: https://synapcores.com/download?utm_source=reddit&utm_medium=owned&utm_campaign=devops7-whatbroke-1030 (free Community Edition).

Your turn: what broke this week, and was it a repeat of something you'd fixed before?


r/devops7 • • Oct 29 '26

Automate it #3: a daily SSL check that warns 14 days before expiry, keeps history, and prints the fix when a cert is already broken

1 Upvotes

Expiry checks are easy. The hard part is the 6 a.m. page that says unable to get local issuer certificate while whoever is on call tries to remember what that means.

So this checker, every morning:

  1. Checks every host, the same way a client would.
  2. Stores every result, so you have history instead of a one-off grep.
  3. Warns 14 days ahead. When a cert is already broken, it prints the fix from your runbook next to the error.

(Disclosure: this sub is run by the SynapCores team, and step 3 uses SynapCores. Run this morning on 2.3.2, real output.)

Setup, once: a results table and a 4-line runbook

CREATE TABLE cert_checks (host TEXT, checked_at TEXT, expires TEXT, days_left INTEGER, issuer TEXT, error TEXT, embedding VECTOR(384));
CREATE TABLE cert_fixes (id INTEGER PRIMARY KEY, problem TEXT, fix TEXT, embedding VECTOR(384));
INSERT INTO cert_fixes (id, problem, fix) VALUES
 (1, 'the certificate is out of date: its end date has passed and nobody renewed it', 'renew it: certbot renew --cert-name HOST, then reload nginx'),
 (2, 'the certificate is for a different domain name than the one the client asked for', 'add the name to the certificate (certbot -d HOST) or fix server_name / DNS'),
 (3, 'the server certificate is signed by itself, not by any certificate authority', 'replace it with a Let''s Encrypt certificate'),
 (4, 'chain incomplete: the issuer''s certificate is not available to the client', 'serve fullchain.pem instead of cert.pem');
UPDATE cert_fixes SET embedding = EMBED(problem);

The runbook is in human words, not error strings. EMBED() runs a small model inside the database and stores what each line means.

The script: cert_check.py (stdlib only; the sql()/quote() helpers are in the first comment)

def check(host):
    try:
        with socket.create_connection((host, 443), timeout=10) as s:
            with ssl.create_default_context().wrap_socket(s, server_hostname=host) as t:
                cert = t.getpeercert()
        expires = datetime.datetime.fromtimestamp(ssl.cert_time_to_seconds(cert["notAfter"]), datetime.UTC)
        issuer = dict(x[0] for x in cert["issuer"]).get("organizationName")
        return expires.date().isoformat(), (expires - datetime.datetime.now(datetime.UTC)).days, issuer, None
    except ssl.SSLCertVerificationError as e:
        return None, None, None, e.verify_message
    except OSError as e:
        return None, None, None, str(e)

now = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%d %H:%M:%S")
for host in open(sys.argv[1]).read().split():
    expires, days, issuer, error = check(host)
    sql(f"""INSERT INTO cert_checks (host, checked_at, expires, days_left, issuer, error, embedding)
            VALUES ({quote(host)}, {quote(now)}, {quote(expires)}, {days if days is not None else 'NULL'},
                    {quote(issuer)}, {quote(error)}, {'EMBED(' + quote(error) + ')' if error else 'NULL'})""")

# 1. expiring soon: plain SQL over this run
for host, days, issuer in sql(f"""SELECT host, days_left, issuer FROM cert_checks WHERE checked_at = {quote(now)}
                                  AND days_left <= {WARN_DAYS} ORDER BY days_left"""):
    print(f"WARN  {host:<28} expires in {days} days ({issuer})")

# 2. broken right now: match the error by meaning to the runbook and print the fix with it
for host, error in sql(f"SELECT host, error FROM cert_checks WHERE checked_at = {quote(now)} AND error IS NOT NULL ORDER BY host"):
    fix, score = sql(f"""SELECT f.fix, COSINE_SIMILARITY(c.embedding, f.embedding) AS score FROM cert_checks c, cert_fixes f
                         WHERE c.host = {quote(host)} AND c.checked_at = {quote(now)} ORDER BY score DESC LIMIT 1""")[0]
    print(f"FAIL  {host:<28} {error}\n      fix ({score:.2f}): {fix.replace('HOST', host)}")

Run it

hosts.txt: 3 healthy sites plus 4 deliberately broken badssl.com hosts:

$ python3 cert_check.py hosts.txt
FAIL  expired.badssl.com           certificate has expired
      fix (0.85): renew it: certbot renew --cert-name expired.badssl.com, then reload nginx
FAIL  incomplete-chain.badssl.com  unable to get local issuer certificate
      fix (0.63): serve fullchain.pem instead of cert.pem
FAIL  self-signed.badssl.com       self-signed certificate
      fix (0.65): replace it with a Let's Encrypt certificate
FAIL  wrong.host.badssl.com        Hostname mismatch, certificate is not valid for 'wrong.host.badssl.com'.
      fix (0.60): add the name to the certificate (certbot -d wrong.host.badssl.com) or fix server_name / DNS
2026-10-29 14:04:15 UTC: 3 ok

Four failures, four right fixes. unable to get local issuer certificate never says what's wrong; by meaning it lands on "chain incomplete": the classic "works in Chrome, fails in curl" missing intermediate. The page says to serve fullchain.pem.

Nothing is inside 14 days today, so here's a wider window to show a warning:

$ WARN_DAYS=35 python3 cert_check.py hosts.txt
WARN  github.com                   expires in 31 days (Sectigo Limited)
(then the same 4 FAIL lines)

Wire it up: 0 7 * * * python3 cert_check.py hosts.txt | grep -A1 -E 'WARN|FAIL', then send that to Slack. Every run stays in cert_checks, so "when did this last renew?" is one query. New kind of failure? Add a line to cert_fixes. More wording (curl, Go) in the first comment.

Free Community Edition: https://synapcores.com/download?utm_source=reddit&utm_medium=owned&utm_campaign=devops7-automate-it-3

What's the TLS error that cost you the longest debugging session?


r/devops7 • • Oct 27 '26

New in v2.4.0: 3 Ollama tutorials (rag with one option, plain-English SQL that keeps PII private, a support bot that's just a model name)

Thumbnail
reddit.com
1 Upvotes

r/devops7 • • Oct 27 '26

Automate it #2: check your access logs every hour, but page only for a new kind of attack (not every new IP)

1 Upvotes

Part 1 found the scanner and the scraper in an access log by hand. Next step is cron: run it hourly, send the result to Slack. Within a week you'll mute the channel: scanners rotate IPs constantly, so "alert on every new bad IP" pages you for the same attack over and over.

The real question each hour: new kind of attack, or the same one from a new address? Same one: block quietly. New kind: page a human.

(Disclosure: this sub is run by the SynapCores team, and the matching step uses SynapCores. Run this morning on 2.3.2, real output.)

Setup, once

CREATE TABLE hour_log (ip TEXT, method TEXT, path TEXT, status INTEGER);
CREATE TABLE suspects (ip TEXT, signature TEXT, embedding VECTOR(384));
CREATE TABLE offenders (ip TEXT, first_seen TEXT, signature TEXT, embedding VECTOR(384));

The script: hourly.py

import json, os, re, sys, urllib.request
URL, TOKEN = os.environ.get("SYNAPCORES_URL", "http://localhost:8080"), os.environ["SYNAPCORES_TOKEN"]
LINE = re.compile(r'(\S+) \S+ \S+ \[([^:]+:\d\d)[^\]]*\] "(\S+) (\S+) [^"]*" (\d{3})')

def sql(q):
    req = urllib.request.Request(URL + "/v1/query/execute", data=json.dumps({"sql": q, "database": "main"}).encode(),
                                 headers={"Authorization": "Bearer " + TOKEN, "Content-Type": "application/json"})
    return json.load(urllib.request.urlopen(req))["data"]["rows"]

def quote(s):
    return "'" + s.replace("'", "''") + "'"

rows = [m.groups() for m in map(LINE.match, open(sys.argv[1])) if m]
hour = rows[0][1]
sql("DELETE FROM hour_log")
for i in range(0, len(rows), 200):
    sql("INSERT INTO hour_log (ip, method, path, status) VALUES " + ", ".join(
        f"({quote(ip)}, {quote(m)}, {quote(re.sub(r'[0-9]+', 'N', p.split('?')[0]))}, {s})"
        for ip, h, m, p, s in rows[i:i + 200]))

# 1. the checks from part 1, per hour: secret probing, scraping, password guessing
suspects = sql("""SELECT ip FROM hour_log WHERE ip NOT IN (SELECT ip FROM offenders) GROUP BY ip
                  HAVING SUM(CASE WHEN status = 404 THEN 1 ELSE 0 END) >= 10 OR COUNT(*) >= 200
                      OR SUM(CASE WHEN status = 401 THEN 1 ELSE 0 END) >= 20 ORDER BY ip""")

# 2. describe what each suspect did, in words, and compare by meaning with every attack already paged
sql("DELETE FROM suspects")
for (ip,) in suspects:
    top = sql(f"""SELECT method, path, status, COUNT(*) AS n FROM hour_log WHERE ip = {quote(ip)}
                  GROUP BY method, path, status ORDER BY n DESC, path LIMIT 6""")
    sig = "; ".join(f"{m} {p} {s}" for m, p, s, n in top)
    sql(f"INSERT INTO suspects (ip, signature, embedding) VALUES ({quote(ip)}, {quote(sig)}, EMBED({quote(sig)}))")

# 3. page only for a new kind of attack; a known attack from a new IP just joins the blocklist
for (ip,) in suspects:
    best = sql(f"""SELECT o.ip, COSINE_SIMILARITY(s.embedding, o.embedding) AS sim FROM suspects s, offenders o
                   WHERE s.ip = {quote(ip)} ORDER BY sim DESC LIMIT 1""")
    if best and best[0][1] >= 0.6:
        print(f"quiet  {ip:<15} same attack as {best[0][0]} ({best[0][1]:.2f}), added to blocklist")
    else:
        print(f"PAGE   {ip:<15} new kind of attack")
    sql(f"""INSERT INTO offenders (ip, first_seen, signature, embedding)
            SELECT ip, {quote(hour)}, signature, embedding FROM suspects WHERE ip = {quote(ip)}""")
print(f"{hour}h: {len(rows)} requests, {len(suspects)} new suspect(s)")

Each suspect gets a short signature (its 6 most common METHOD path status lines). EMBED() turns it into a vector inside the database, and COSINE_SIMILARITY compares it with every attack on file. 0.6 or higher = same attack: blocklist, no page.

Run it on two hours of traffic

$ python3 hourly.py access-09.log
PAGE   192.0.2.77      new kind of attack
PAGE   198.51.100.23   new kind of attack
27/Oct/2026:09h: 434 requests, 2 new suspect(s)
$ python3 hourly.py access-10.log
quiet  104.28.40.17    same attack as 198.51.100.23 (0.90), added to blocklist
PAGE   198.51.100.140  new kind of attack
27/Oct/2026:10h: 387 requests, 2 new suspect(s)
$ python3 hourly.py access-10.log
27/Oct/2026:10h: 387 requests, 0 new suspect(s)

Hour 10 is the interesting one. 198.51.100.23 came back but is already known. 104.28.40.17 is a new IP probing completely different paths (/.env.production, /.git/HEAD, /backup.sql, /.ssh/id_rsa vs /.env, /.git/config, /.aws/credentials). Not one path in common, so exact matching would page you again. By meaning it's the same "hunting for secret files" attack (0.90), so it's blocked quietly. The password guesser (POST /login 401 x90) scores 0.24 at most against anything on file, so it's the only page. Rerun: silence.

Wire it up: cron it at 5 * * * * on last hour's log, send grep PAGE to Slack, and feed SELECT ip FROM offenders to fail2ban. Same attack scored 0.90, different ones 0.24 or less, so 0.6 sits in the gap; check yours on a week of real logs.

Sample logs: first comment. Free Community Edition: https://synapcores.com/download?utm_source=reddit&utm_medium=owned&utm_campaign=devops7-automate-it-2

What attack fills your logs most: .env hunters, wp-login guessers, or something weirder?


r/devops7 • • Oct 26 '26

One script, one chore: which errors in last night's log are actually new? (20 lines of Python, match by meaning instead of grep)

1 Upvotes

Every morning someone scrolls last night's errors and asks the same thing: is any of this new, or is it the usual noise?

grep -v and exact-match dedup don't help, because the usual noise never repeats exactly. attempt 3/5 becomes attempt 5/5, after 30s becomes after 30000ms, 93% becomes 95%. So every line looks new and you stop reading.

The chore: keep a list of errors you've already triaged, and print only the lines that don't mean the same thing as anything on it.

(Disclosure: this sub is run by the SynapCores team, and the matching step below uses SynapCores. Tested on 2.3.2 this morning.)

Setup, once

CREATE TABLE known_errors (id INTEGER PRIMARY KEY, msg TEXT, embedding VECTOR(384));
CREATE TABLE todays_errors (id INTEGER PRIMARY KEY, msg TEXT, embedding VECTOR(384));

INSERT INTO known_errors (id, msg) VALUES
 (1, 'connection refused to db-primary:5432'),
 (2, 'timeout waiting for upstream payments-api after 30s'),
 (3, 'disk usage above 90% on /var/lib/docker'),
 (4, 'OOMKilled: container worker exceeded memory limit 512Mi'),
 (5, 'TLS handshake failed: certificate expired for api.internal');

UPDATE known_errors SET embedding = EMBED(msg);

EMBED() runs a small embedding model inside the database and stores what each message means as 384 numbers. No API key.

The script: new_errors.py

import json, os, sys, urllib.request
URL, TOKEN = os.environ.get("SYNAPCORES_URL", "http://localhost:8080"), os.environ["SYNAPCORES_TOKEN"]

def sql(q):
    req = urllib.request.Request(URL + "/v1/query/execute", data=json.dumps({"sql": q, "database": "main"}).encode(),
                                 headers={"Authorization": "Bearer " + TOKEN, "Content-Type": "application/json"})
    return json.load(urllib.request.urlopen(req))["data"]["rows"]

def quote(s):
    return "'" + s.replace("'", "''") + "'"

errors = sorted({line.split(" ERROR ", 1)[1].strip() for line in open(sys.argv[1]) if " ERROR " in line})
sql("DELETE FROM todays_errors")
sql("INSERT INTO todays_errors (id, msg) VALUES " +
    ", ".join(f"({i}, {quote(e)})" for i, e in enumerate(errors, 1)))
sql("UPDATE todays_errors SET embedding = EMBED(msg)")
for msg, closest in sql("""SELECT t.msg, MAX(COSINE_SIMILARITY(t.embedding, k.embedding)) AS closest
                           FROM todays_errors t, known_errors k GROUP BY t.msg
                           HAVING MAX(COSINE_SIMILARITY(t.embedding, k.embedding)) < 0.6 ORDER BY closest"""):
    print(f"NEW  {closest:.2f}  {msg}")

Run it on last night's log (9 lines, 7 of them ERROR)

$ python3 new_errors.py app.log
NEW  0.16  redis: READONLY You can't write against a read only replica
NEW  0.19  permission denied writing to /var/log/app/audit.log

Two out of seven. The other five were dropped because each is close in meaning to a known error (1.0 = same meaning):

disk usage 93% on /var/lib/docker                         0.97
container worker OOMKilled, memory limit 512Mi reached    0.97
connection refused to db-primary:5432 (attempt 3/5)       0.96
connection refused to db-primary:5432 (attempt 5/5)       0.95
upstream payments-api timed out after 30000ms             0.89

Look at timed out after 30000ms vs timeout waiting for upstream payments-api after 30s: different words, different units, still 0.89. That's the line exact-match dedup can never catch. The gap between 0.89 and 0.19 is wide, so 0.6 is a safe cut here; check yours on a week of real logs before trusting it.

Once you've triaged a new one, teach it

INSERT INTO known_errors (id, msg, embedding)
  SELECT 100 + id, msg, embedding FROM todays_errors WHERE id IN (5, 6);

Tomorrow those two stay quiet too. Put the script in cron at 08:00, pipe the output to Slack, and an empty message means a boring night.

Free Community Edition if you want to try it: https://synapcores.com/download?utm_source=reddit&utm_medium=owned&utm_campaign=devops7-new-errors

What's one error message your team has learned to ignore?


r/devops7 • • Oct 23 '26

Find the bots hammering your server: load your nginx access log into SQL and ask 5 questions (beginner, ~15 min)

1 Upvotes

Grepping access logs works until the question gets interesting: who is probing for .env files? Who sent 240 requests in one minute? Is that "Googlebot" really Google? Those are GROUP BY questions, and SQL answers them in one line each.

This walkthrough loads a standard nginx/Apache access log (combined format) into a database table with a ~30-line Python script, then runs five queries. I use SynapCores, the self-hosted database our team builds (full disclosure: this sub is run by the same people), but the SQL is plain and works almost anywhere.

What you need

  • A running SynapCores Community Edition (free; one-line installer or Docker at synapcores.com/download). Any SQL database works if you adapt the loader.
  • Python 3, standard library only.
  • An access token: log in once with POST /v1/auth/login and export it as SYNAPCORES_TOKEN.

No logs handy? The generator script in the first comment writes a realistic sample access.log (706 requests: normal visitors, a real crawler, a vulnerability scanner, a scraper, and a fake Googlebot).

Step 1: load the log

load_log.py parses each line with a regex and inserts rows 200 at a time:

import json, os, re, sys, urllib.request
URL, TOKEN = os.environ.get("SYNAPCORES_URL", "http://localhost:8080"), os.environ["SYNAPCORES_TOKEN"]
LINE = re.compile(r'(\S+) \S+ \S+ \[([^\]]+)\] "(\S+) (\S+) [^"]*" (\d{3}) (\d+|-) "[^"]*" "([^"]*)"')

def sql(statement):
    req = urllib.request.Request(URL + "/v1/query/execute",
                                 data=json.dumps({"sql": statement, "database": "main"}).encode(),
                                 headers={"Authorization": "Bearer " + TOKEN, "Content-Type": "application/json"})
    return json.load(urllib.request.urlopen(req))["data"]

def quote(s):
    return "'" + s.replace("'", "''") + "'"

sql("""CREATE TABLE IF NOT EXISTS access_log (
         ip TEXT, ts TEXT, minute TEXT, method TEXT, path TEXT, status INTEGER, bytes INTEGER, user_agent TEXT)""")
rows = []
for raw in open(sys.argv[1]):
    m = LINE.match(raw)
    if not m:
        continue
    ip, ts, method, path, status, size, ua = m.groups()
    rows.append(f"({quote(ip)}, {quote(ts)}, {quote(ts[:17])}, {quote(method)}, {quote(path)}, "
                f"{status}, {0 if size == '-' else size}, {quote(ua)})")
for i in range(0, len(rows), 200):
    sql("INSERT INTO access_log (ip, ts, minute, method, path, status, bytes, user_agent) VALUES "
        + ", ".join(rows[i:i + 200]))
print(f"loaded {len(rows)} requests into access_log")

$ python3 load_log.py access.log
loaded 706 requests into access_log

(minute is the timestamp cut to the minute, 22/Oct/2026:09:41, so we can count bursts.)

Step 2: who sends the most requests?

SELECT ip, COUNT(*) AS requests FROM access_log
GROUP BY ip ORDER BY requests DESC LIMIT 5;

192.0.2.77      240
66.249.66.12     30
198.51.100.23    24
203.0.113.18     13
203.0.113.35     13

One IP is 34% of all traffic. Suspicious, but volume alone doesn't prove anything.

Step 3: who is hunting for secrets?

SELECT ip, COUNT(*) AS probes FROM access_log
WHERE status = 404 AND (path LIKE '%.env%' OR path LIKE '%.git%' OR path LIKE '%wp-login%'
      OR path LIKE '%phpmyadmin%' OR path LIKE '%.aws%' OR path LIKE '%config.json%')
GROUP BY ip ORDER BY probes DESC;

198.51.100.23   24
198.51.100.99   12

Nobody legitimate asks your server for /.aws/credentials. These two are scanners.

Step 4: who is bursting?

SELECT ip, minute, COUNT(*) AS hits FROM access_log
GROUP BY ip, minute HAVING COUNT(*) > 60 ORDER BY hits DESC;

192.0.2.77   22/Oct/2026:09:41   240

240 requests in one minute (4 per second) is a scraper, not a person.

Step 5: is that Googlebot real?

SELECT ip, COUNT(*) AS requests,
       SUM(CASE WHEN status = 404 THEN 1 ELSE 0 END) AS not_found
FROM access_log WHERE user_agent LIKE '%Googlebot%' GROUP BY ip;

198.51.100.99   12   12
66.249.66.12    30    0

Same user agent, two very different behaviors. The real crawler (66.249.x is in Google's published ranges) fetched real pages. The impostor only requested secret files. Anyone can type "Googlebot" into a User-Agent header, so verify against the published IP ranges (or a reverse DNS lookup) before you trust it.

Step 6: what's actually talking to you?

SELECT user_agent, COUNT(*) AS requests FROM access_log
GROUP BY user_agent ORDER BY requests DESC LIMIT 5;

python-requests/2.31.0 with 240 requests is your scraper again.

What to do with this

  • Feed the scanner IPs from step 3 to fail2ban or your firewall.
  • Rate-limit by IP when step 4 shows more than N hits per minute.
  • Keep the table and load new logs daily. Tomorrow you'll ask "is this IP new?" and that's one more query.

We did exactly this on our own servers last week and found a scanner farm using Cloudflare Worker IPs to dodge blocklists. Next post: run these checks automatically every hour and get alerted only when something new shows up.

What do you look for first when you open an access log?


r/devops7 • • Oct 20 '26

Your ML Model Called This Fraud Ring NORMAL

Thumbnail
youtube.com
1 Upvotes

r/devops7 • • Aug 21 '26

Give Your Agent Fleet a Shared Brain — Why Most “AI Agent Memory” Can Never Scale Past One Machine

Thumbnail
medium.com
1 Upvotes

r/devops7 • • Aug 12 '26

What's silently failing in your stack right now and you just don't know it yet?

1 Upvotes

Saw a thread a while back about "the most temporary thing that's now load-bearing in prod" and it got me thinking about a scarier version of that question — not the thing you know is fragile, but the thing that's already broken and reporting success anyway.

We found one of these in our own system a couple weeks ago. A scheduled automation job (running on our database engine, SynapCores) was supposed to log which tools it called before saving its own run history — except that record was silently getting stripped before it got written. So the next run looked at its own history, saw "no tools were called, that's fine," and copied the pattern. Run 1 worked. Run 10 did nothing and logged "success" anyway.

The scary part wasn't the bug — it was that nothing in monitoring caught it. Uptime was fine. Error rate was fine. The job just quietly stopped doing its job while reporting everything was great.

Made me realize how much of what we call "monitoring" only catches things that fail loudly.

Anyone else have a story like this — something technically "succeeding" while doing nothing useful, and how long did it run before someone caught it?

(Also — been away from this sub for a while. If anyone's still around, what are you working on these days?)


r/devops7 • • May 26 '26

Be brutally honest: Is the mobile infrastructure triage reality completely broken?

1 Upvotes

Hey everyone,
I'm doing some deep research into on-call developer workflows and the specific micro-miseries of infrastructure triage.
I'm trying to map out exactly what happens in those first 5–10 minutes when a high-priority alert fires and you happen to be away from your desk (grabbing lunch, walking the dog, at dinner, etc.).
I'd love to hear your raw thoughts on a few specific things:
1 **The Tethering Tax:** How often do you actually have to abandon what you're doing, run home, or pull over on the highway just to open a laptop for a simple 2-minute check or basic restart?
2 **The First 5 Minutes:** What are the most repetitive, mundane commands or log checks you run immediately just to figure out what is actually broken? (e.g., checking memory usage, fetching the last few container logs, checking DB connections).
3 **The Mobile Reality:** Why do current mobile tools (PagerDuty app, AWS Console mobile, Slack integrations) fall short for quick, out-of-pocket triage?
**The Hypothetical Scenario:**
If you could securely get the answer to a basic status query (e.g., "Is the auth database disk space full?") or trigger a predefined, safe fallback script via a quick audio snippet/voice note on your phone while walking back to your car, would that actually alleviate the "laptop rush" dread, or is voice inherently a terrible interface for infrastructure?
(And yes, before anyone points it out in the comments, my username absolutely betrays my bias—I'm deeply fascinated by the idea of zero-keyboard workflows for on-call mitigation, but I'm here for the brutal, unvarnished truth of why this might be a nightmare in practice.)
Curious to hear your worst on-call stories and what those initial triage bottlenecks look like for you.


r/devops7 • • Mar 10 '26

Building a dashboard for tracking live sports games

1 Upvotes

I started working on a small side project called SportsFlux after getting frustrated trying to track games across multiple leagues. The idea is simple: organize live sports games into one dashboard so it's easier to see what's playing without jumping between different platforms. It started as a personal tool but I’m thinking of improving it further. Would love feedback or ideas on what features would be useful.

https://SportsFlux.live


r/devops7 • • Feb 06 '26

Built this AWS DevOps architecture as a fresher. WIP and feeling stuck. What should I fix?

Post image
1 Upvotes

Hi everyone,

I’m a student and a fresher learning DevOps, and this is an AWS architecture diagram I’ve put together based on my current understanding.

This is very much a work in progress and honestly, a bit half-baked right now. I’ve reached a point where I feel slightly stuck and unsure whether I’m even moving in the right direction, which is why I’m posting this here.

The intent was to design a fairly realistic setup covering CI/CD, networking, web/app/database layers, and Kubernetes. But I’m sure there are gaps, incorrect assumptions, and things that don’t make sense in real-world systems.

I’d really appreciate feedback on:

•	Whether the overall direction makes sense

•	What’s missing, unnecessary, or over-engineered

•	Conceptual mistakes or bad practices

•	How this would typically be done in production

My goal is to learn, correct myself early, and bridge the gaps in my understanding. Any honest review or critique would be a huge help.

Thanks in advance 🙏


r/devops7 • • Jan 10 '26

VECTOR columns for embeddings in SQL — semantic search without a separate vector DB

Thumbnail reddit.com
1 Upvotes

r/devops7 • • Nov 01 '25

Why Your Database Can’t Actually See Your Users (And What That’s Really Costing You)

Thumbnail
medium.com
1 Upvotes

r/devops7 • • Sep 10 '25

Workshops Learning vs Books Learnings

2 Upvotes

Where do we learn better — at workshops and hands-on sessions, or from books?

Workshops, hands-on sessions — they give you the spark.

They show you why something matters and let you try it out in real time. You walk away inspired, curious, motivated.
Books, on the other hand, give you the depth.

They slow you down, let you revisit concepts, connect the dots, and build mastery step by step.

Maybe the real answer isn’t choosing between online events and books.

Maybe it’s about using events for inspiration and practice, and books for depth and mastery.
What do you think — which has helped you more in your journey?


r/devops7 • • Jul 29 '25

Tech Companies that are thriving now, sustancial growth for Q3 and Q4

2 Upvotes

Several companies are experiencing substantial growth in Q3 and Q4 of 2025. The following categories and examples provide a snapshot of the companies and sectors thriving now:

Top Individual Growth Stocks

  • Sezzle Inc (SEZL): Up 835% over the past year, making it one of the standout performers in 2025.
  • Palantir Technologies (PLTR): Gained more than 439%, bolstered by AI adoption and contract wins.
  • Dave Inc (DAVE) and Applovin Corp (APP): Experienced gains of 392% and 330%, respectively.
  • Amer Sports Inc (AS), Avino Silver & Gold Mines (ASM), and Niagen Bioscience (NAGE) have also demonstrated performance above +200% in 202512.

Other High-Growth Companies

  • Tesla and BYD: Remain strong in the electric vehicle market, despite global uncertainties34.
  • Nvidia and Broadcom: Continue to benefit from the ongoing AI and cloud computing boom, delivering sector-leading revenue and profit growth352.
  • Lucid Group: Projected to double its sales year-over-year due to the launch of new EV models and strong order volume4.
  • Super Micro Computer (SMCI): Noted for a 39% earnings growth, driven by AI infrastructure demand6.

High-Growth Sectors

  • Technology (Software, Cloud, AI, Cybersecurity): Leading the charge as digital transformation accelerates. Companies in cloud, software-as-a-service (SaaS), AI platforms, and tech infrastructure show annualized revenue growth of 25–30% and high net retention rates78.
  • Healthcare and Biotechnology: Biotech and medical devices are thriving, supported by new FDA approvals, demographic trends, and strong demand for innovative therapies78.
  • Clean Energy and Utilities: Solar, battery tech, and energy storage are seeing robust expansion, with names like FTC Solar and Enovix recording annualized growth above 60%6.
  • E-commerce and Online Retail: The sustained digital shopping shift and omni-channel innovations are driving top lines for relevant players8.

Fastest-Growing Private Tech Companies (2022–2024 Headcount Growth)

CompanySectorValuationNotable Growth Factor
PersonioHR SaaS$8.5B688 employees added since 2022
MewsHospitality SaaS$1.2B687 new hires, global hotel industry expansion
Apollo.ioSales engagement$1.6B420 new hires, sales automation demand
VantaSecurity/Compliance$2.4B345 new hires, cybersecurity boom
DrataCompliance$2.0B342 new hires, automated audit certifications
ZipHQProcurement SaaS$2.2B233 new hires, enterprise software penetration

Other Notable Growth Stocks

  • Innodata (INOD): Delivered 626% EPS growth and 120% revenue growth by supplying AI training data.
  • EverQuote: Reported an 83% revenue increase with an expanding AI-driven insurance marketplace2.
  • Kapston, Vertoz, Pitti, and Cupid: Reported significant profit growth for Q3, attributed to business expansion and mergers10.

Summary

The most substantial growth in Q3 and Q4 2025 is being seen in technology (especially software, cloud, and AI), electric vehicles, specialized fintech, healthcare/biotechnology, clean energy, and SaaS companies. Standouts include Sezzle, Palantir, Tesla, Nvidia, Lucid Group, and several innovative private tech firms. Growth is often driven by the adoption of AI, digital infrastructure upgrades, green initiatives, and a surge in healthcare innovation751.

  1. https://www.nerdwallet.com/article/investing/best-performing-growth-stocks
  2. https://www.investopedia.com/the-best-tech-stocks-8781414
  3. https://www.tradu.com/eu/insights/shares/top-10-stocks-for-q3-2025-part-2/
  4. https://www.nasdaq.com/articles/3-fastest-growing-stocks-planet-2025
  5. https://money.usnews.com/investing/articles/best-growth-stocks-to-buy
  6. https://finance.yahoo.com/news/top-growth-companies-insider-stakes-173545251.html
  7. https://www.forbes.com/sites/investor-hub/article/my-best-5-sectors-to-invest-in-q3-2025/
  8. https://www.bitcot.com/fastest-growing-industries/
  9. https://nubela.co/blog/post-funding-growth-data-report/
  10. https://www.taxtmi.com/news?id=34326
  11. https://www.morningstar.com/markets/q3-2025-stock-market-outlook-after-rally-whats-still-undervalued
  12. https://finance.yahoo.com/news/july-2025-insider-owned-growth-173544652.html
  13. https://fsinvestments.com/fs-insights/q3-2025-us-economic-outlook-strong-winds-deep-roots/
  14. https://finance.yahoo.com/news/high-insider-confidence-growth-stocks-173546476.html
  15. https://explodingtopics.com/blog/business-trends
  16. https://www.screener.in/screens/2232724/best-stock-for-investment-2025/
  17. https://www.stash.com/learn/growth-stocks-to-invest-in-for-2025/
  18. https://hoffmancorporation.com/q4-2024-recap-q1-2025-outlook/
  19. https://techpoint.africa/guide/fastest-growing-companies/
  20. https://www.chicagobusiness.com/fast-50/fastest-growing-companies-2025

r/devops7 • • Jun 06 '25

What is a Chief AI Officer and Why Your Company Needs One

Thumbnail
medium.com
2 Upvotes

r/devops7 • • Jun 03 '25

Are you struggling to improve your website's search engine rankings?

1 Upvotes

📢 Attention website owners and digital marketers! 📢

Are you tired of your website not ranking as well as you'd like in search engines? The solution might be simpler than you think – it's all about technical SEO!

Our latest article dives deep into the technical factors that impact your website's performance and search engine rankings. From website infrastructure to page speed optimization and mobile-friendliness, we cover it all.

🔍 Discover key technical SEO factors

🚀 Learn how to improve your website's crawlability

⚡ Understand the importance of page speed and Core Web Vitals

🔒 Explore HTTPS implementation and website security

Don't let technical SEO hold your website back any longer. Read our comprehensive guide and start optimizing your site today!

👉 Read the full article here: https://tomorrowoffers.com/technical-seo-factors-that-impact-website-performance/

And if you need a studio that can revamp your site in record time connect with us at: https://cmcreative.us/custom-web-development

#TechnicalSEO #WebsiteOptimization #DigitalMarketing


r/devops7 • • May 17 '25

🚀 Planning a website redesign for your business? Don't get caught off guard by unexpected timelines!

18 Upvotes

Our latest article breaks down everything you need to know about website redesign timelines, including:

✅ Factors that influence project duration

✅ Different types of redesigns and their typical timelines

✅ Tips to accelerate your redesign process

Whether you're a small business owner or managing a large enterprise, understanding the timeline for your website redesign is crucial for setting realistic expectations and managing your project effectively.

Ready to take your website to the next level? Check out our comprehensive guide on website redesign timelines here: https://tomorrowoffers.com/how-long-should-a-website-redesign-take-timelines/

#WebsiteRedesign #DigitalStrategy #BusinessGrowth