package
4.1.3+incompatible
Repository: https://github.com/els0r/goprobe.git
Documentation: pkg.go.dev

# README

goProbe legacy DB conversion tool

The legacy tool / binary is used to convert existing goProbe databases from a pre-v4.x format to the current database format. In the course of the conversion, size on disk is significantly reduced (by a factor of about 2-7 depending on the traffic pattern observed on the collecting host).

Command line interface / usage

# legacy -h
Usage of legacy:
  -debug
    	Enable debug / verbose mode
  -dry-run
    	Perform a dry-run (default true)
  -i string
    	Path to (legacy) input goDB
  -l int
    	Custom LZ4 compression level (uses internal default if <= 0)
  -n int
    	Number of parallel conversion workers (default [[NUM_CPU/2]])
  -o string
    	Path to output goDB
  -p string
    	Permissions to use when writing files to DB (UNIX octal file mode) (default "644")
  -profile string
    	Path to output CPU profile

Notes

  • For safety reasons, the legacy tool does not perform / offer in-place conversion
  • When -debug mode is enabled, a log message will be emitted for each converted daily directory (which may be a lot if the database is sufficiently large)
  • Default file permissions for the output database are rather permissive (anybody can read), depending on the security requirements reducing permissions to e.g. 600 may be advisable.
  • Appropriate directory (+x) permissions will automatically be applied to keep access consistent with the requested file permissions

Examples

Perform a dry-run first (default) using four parallel workers (will perform all actions except for the actual writeout):

# legacy -n 4 -i /path/to/legacy/db -o /path/tp/output/db

If no errors are reported, perform the actual conversion:

# legacy -dry-run=false -n 4 -i /path/to/legacy/db -o /path/tp/output/db

After successful conversion, point goProbe / goQuery (>=v4.x) to the output database. Alternatively, delete / replace the legacy data with the converted one and update the existing configuration.

# Functions

New returns a new GPFile object to read and write goProbe flow data.
NewLegacyFileSet instantiates a new legacy DB file set.
NewLegacyGPFile returns a new LegacyGPFile object to read and write goProbe flow data.
NewModernFileSet instantiates a new DB file set.
ReadMetadata reads the metadata from the supplied filepath.
WithEncoder allows to set the compression implementation.
WithReadAll triggers a full read of the underlying file from disk upon first read access to minimize I/O load.

# Constants

BufSize allocates space for the header (512 slots for 64bit integers).
FileSuffix denotes the suffix used for the raw data stored.
HeaderFileSuffix denotes the suffix used for the header data.
MetadataFileName denotes the static filename for the metadata.
ModeRead denotes read access.
ModeWrite denotes write / append access.
512.

# Structs

BlockHeader denotes a list of blocks pertaining to a storage backend.
BlockMetadata represents metadata for one database block.
GPFile implements the binary data file used to store goProbe's flows.
LegacyFileSet denotes a collection of all files required to read / parse a legacy DB directory.
LegacyGPFile implements the binary data file used to store goProbe's flows.
Metadata for a collection of database blocks.
ModernFileSet denotes a collection of all files required to read / parse a DB directory.

# Type aliases

Option defines optional arguments to gpfile.