logscrub

package
v0.2.0-dev.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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>"
)
View Source
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

View Source
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

func Addrs(s string) string

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 Clip

func Clip(s string, max int) string

Clip cuts s to at most max bytes on a rune boundary.

func ClipRunes

func ClipRunes(s string, max int) string

ClipRunes cuts s to at most max runes.

func Credentials

func Credentials(s string) string

Credentials replaces every Authorization / Proxy-Authorization header value and every Basic or Bearer credential in s by "[REDACTED]". Credentials(Credentials(s)) == Credentials(s).

func Emails

func Emails(s string) string

Emails replaces every e-mail address (in any script) by Email.

func HomePaths

func HomePaths(s string) string

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

func Hosts(s string) string

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

func HostsKnownTLD(s string, fileWins ...string) string

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

func MACs(s string) string

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

func ReplaceFold(s, needle, with string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL