Security and Privacy¶
Failed SSH logins by IP and user¶
kelora examples/sshd_auth.log --input-year 2024 \
--filter 'e.msg.starts_with("Failed password")' \
-e 'e.ip = e.msg.extract_ip(); e.user = e.msg.extract_regex("for (?:invalid user )?(\\S+)", 1)' \
--freq ip --freq user
ip (3 values):
value count
203.0.113.77 4
198.51.100.23 2
192.0.2.200 1
user (4 values):
value count
root 3
admin 2
oracle 1
test 1
Read JWT claims¶
parse_jwt() decodes a token without verifying the signature — for
debugging, not for trusting:
kelora examples/auth-logs.jsonl \
-e 'let t = e.token.parse_jwt(); e.sub = t.claims.sub; e.role = t.claims.role; e.expires = t.expires_at' \
-k timestamp,sub,role,expires
timestamp='2024-01-15T10:00:00Z' sub='user123' role='admin'
expires='2024-11-21T01:46:40+00:00'
timestamp='2024-01-15T10:05:00Z' sub='user456' role='user'
expires='2024-11-21T02:46:40+00:00'
timestamp='2024-01-15T10:10:00Z' sub='user789' role='guest'
expires='2023-11-14T22:13:20+00:00'
timestamp='2024-01-15T10:15:00Z' sub='user111' role='moderator'
expires='2024-11-21T03:46:40+00:00'
Requests from one network¶
ip='198.51.100.77' path='/api/reports' status=500
ip='198.51.100.88' path='/api/upload' status=413
ip='198.51.100.99' path='/api/analytics?date=2025-01-15&metric=views' status=200
Mask addresses inside free text¶
kelora examples/email_logs.log -f 'cols:ts level *msg' -e 'e.msg = e.msg.normalized(["email", "ipv4"])' -n 3
ts='2025-01-15T10:23:45Z' level='INFO'
msg='Email sent from <email> to <email> subject="Welcome"'
ts='2025-01-15T10:24:12Z' level='INFO'
msg='Email received from <email> to <email> subject="Support Request"'
ts='2025-01-15T10:24:33Z' level='WARN'
msg='Bounced email to <email> reason="Domain not found"'
Consistent pseudonyms¶
The same input gives the same alias as long as KELORA_SECRET stays the
same, so you can still count, join, and follow a user across files:
KELORA_SECRET=change-me kelora examples/user-data.jsonl \
-e 'e.user = pseudonym(e.email, "user"); e.email = (); e.ip = e.ip.mask_ip(1)' -k user,action,ip
user='g8tM8VSw0JPXBMVPhDpsj0Zf' action='login' ip='192.168.1.0'
user='VBFT1D7bynhXWHogMn2-JsRh' action='purchase' ip='10.0.5.0'
user='MaUceTZy9kaE5V2HOavznCDY' action='view' ip='172.16.88.0'
user='Tq9oFjjc-1WvdC9mCHqAC5YQ' action='logout' ip='192.168.1.0'
user='4q0StVl3bHi6gqkOSXZzOA8f' action='login' ip='10.0.5.0'
Pseudonymize IP addresses¶
--pseudonymize ip replaces every address in every field, inside messages
too, with a keyed token. It runs right after parsing, so filters, --freq and
--discover see only tokens; the same address keeps the same token while
KELORA_SECRET stays the same:
KELORA_SECRET=change-me kelora examples/sshd_auth.log --input-year 2024 \
--pseudonymize ip -k msg -n 3
msg='Accepted publickey for deploy from <ip:j7lEFbSZvlI4erFlvAwUxbzf> port 52114 ssh2: ED25519 SHA256:q2Xw'
msg='Failed password for invalid user admin from <ip:wuukJmb_X0e9Dmt1FaY0h3SU> port 40122 ssh2'
msg='Failed password for invalid user admin from <ip:wuukJmb_X0e9Dmt1FaY0h3SU> port 40122 ssh2'
extract_ip() returns the tokens, so you can still count failed logins per
source address without seeing one:
KELORA_SECRET=change-me kelora examples/sshd_auth.log --input-year 2024 \
--pseudonymize ip --filter 'e.msg.starts_with("Failed password")' \
-e 'e.src = e.msg.extract_ip()' --freq src
src (3 values):
value count
<ip:wuukJmb_X0e9Dmt1FaY0h3SU> 4
<ip:75CgnUwejaQQUW_irMcQGSxb> 2
<ip:BqgbtaN-gmRl5rBJAHQokX0m> 1
A filter never sees a real address either. To look for a known one, pseudonymize the literal the same way:
KELORA_SECRET=change-me kelora examples/sshd_auth.log --input-year 2024 \
--pseudonymize ip --filter 'e.msg.contains("198.51.100.23".pseudonymize_ips())' -k msg
msg='Failed password for invalid user oracle from <ip:75CgnUwejaQQUW_irMcQGSxb> port 51002 ssh2'
msg='Failed password for invalid user test from <ip:75CgnUwejaQQUW_irMcQGSxb> port 51188 ssh2'
Add email to replace email addresses the same way:
user_id='user001' email='<email:RIf3Lw9s5T04dtVK1ZehhKBA>' action='login'
ip='<ip:P6s5Q_jZIOqzKacDDQuPy99b>'
user_id='user002' email='<email:yQV5MLU96Qw3tOs6V3mLXqkO>' action='purchase'
ip='<ip:aTbTuZZ7EhVWFLLSrG3Ry5tE>'
Find the address behind a token¶
Tokens can't be reversed, but whoever holds the secret and the original log can
look one up, say after a recipient reports <ip:wuukJmb_X0e9Dmt1FaY0h3SU>:
KELORA_SECRET=change-me kelora examples/sshd_auth.log --input-year 2024 \
--filter 'e.msg.pseudonymize_ips().contains("<ip:wuukJmb_X0e9Dmt1FaY0h3SU>")' -k msg -n 1
Pseudonymize IPs but keep subnets¶
--pseudonymize ip-prefix replaces each address with another of the same
family; addresses that share a prefix still share one afterwards (10.0.5.23
and 10.0.5.24 stay in one /24):
user_id='user001' ip='64.168.98.21'
user_id='user002' ip='245.126.84.248'
user_id='user003' ip='50.206.38.29'
user_id='user004' ip='64.168.98.20'
user_id='user005' ip='245.126.84.246'
Pseudonymize a network the same way to filter by it:
KELORA_SECRET=change-me kelora examples/user-data.jsonl --pseudonymize ip-prefix \
--filter 'e.ip.is_in_cidr("10.0.0.0/8".pseudonymize_ips("prefix"))' -k user_id,ip
Prefixes are exactly what an attacker can use against it; for data that leaves your control, prefer --pseudonymize ip (trade-offs). For one field only, use pseudonymize_ips() in --exec.
Drop sensitive fields¶
-K token,password hides fields from the output; e.token = () in --exec
removes them before later stages and summaries see them.