Documentation
¶
Overview ¶
Package logscrub cuts IP addresses out of log text that leaves a node (the node journal, agent.proto JournalEntry). The agent cleans before sending and the panel cleans again on intake. Names, versions, times and hashes stay, except in xray's text (Hosts), where a name may be a destination.
Index ¶
- Constants
- Variables
- func Addrs(s string) string
- func Clip(s string, max int) string
- func ClipRunes(s string, max int) string
- func Emails(s string) string
- func HomePaths(s string) string
- func Hosts(s string) string
- func HostsKnownTLD(s string, fileWins ...string) string
- func MACs(s string) string
- func ReplaceFold(s, needle, with string) string
Constants ¶
const ( // IP replaces an address; IPPort an address with a port (the port too: a client's source port is noise and // makes every line unique). IP = "<ip>" IPPort = "<ip>:port" Host = "<host>" )
const ( // MAC replaces a hardware address; Email an e-mail address; User the account name in a home directory; Computer the name of a // Windows machine that Windows made up. MAC = "<mac>" Email = "<email>" User = "<user>" Computer = "<computer>" )
Variables ¶
var JournalAttrs = [...]string{
"inbound", "protocol", "profile", "port", "state", "reason", "code", "backend", "mode", "version",
"kernel", "iface", "check", "fix", "count", "err", "error", "event", "peer",
}
JournalAttrs are the only attribute keys a journal entry carries, on the node and again in the panel (agent.proto JournalEntry).
Functions ¶
func Addrs ¶
Addrs replaces every IP address in s by IP, or by IPPort when it carries a port. Unspecified and loopback addresses (0.0.0.0, ::, 127.0.0.1, ::1) are the node's own and stay. Addrs(Addrs(s)) == Addrs(s).
func HomePaths ¶
HomePaths replaces the account name in a home directory of Windows (C:\Users\Name\..., also on a share), Linux (/home/name/...) and macOS (/Users/name/...) by User, keeps the rest of the path, and the made-up name of a Windows machine by Computer.
func Hosts ¶
Hosts replaces every DNS name by Host. For text that may name a destination (xray's), where a lost file or domain name costs less than a site someone visited.
func HostsKnownTLD ¶
HostsKnownTLD replaces every DNS name whose last label is a real top-level domain by Host, in any script. A name that ends in anything else is left: System.Net.Http.HttpRequestException, settings.ini and app.exe.config are no destinations. fileWins (lower case) lists the endings that are a top-level domain and also a common file extension (zip, py, sh ...): a name ending in one of them is taken for a file and left. Everything else that is a top-level domain is a host, even if it is also an extension.
func MACs ¶
MACs replaces every hardware address by MAC. A run of hex digits that merely contains the shape (a longer word) stays, and the search goes on inside it: "mac:aa:bb:cc:dd:ee:ff" begins with "ac:aa:bb:…", which is no address, and the address follows.
func ReplaceFold ¶
ReplaceFold replaces every occurrence of needle in s with with, ignoring the case of ASCII letters (a secret name is a DNS name or a path prefix, and a log may spell it either way). Only ASCII letters fold, so offsets in the folded copy are those of the original. An empty needle replaces nothing.
Types ¶
This section is empty.