Documentation
¶
Overview ¶
Package backends provides storage backend implementations for audit log data.
Index ¶
- type AzureBackend
- func (ab *AzureBackend) Close() error
- func (ab *AzureBackend) Name() string
- func (ab *AzureBackend) Read(_, _ time.Time) ([]*core.LogEvent, error)
- func (ab *AzureBackend) VerifyIntegrity() (*IntegrityReport, error)
- func (ab *AzureBackend) Write(event *core.LogEvent) error
- func (ab *AzureBackend) WriteBatch(events []*core.LogEvent) error
- type AzureConfig
- type Backend
- type BackendError
- type Config
- type FilesystemBackend
- func (fb *FilesystemBackend) Close() error
- func (fb *FilesystemBackend) Name() string
- func (fb *FilesystemBackend) Read(start, end time.Time) ([]*core.LogEvent, error)
- func (fb *FilesystemBackend) VerifyIntegrity() (*IntegrityReport, error)
- func (fb *FilesystemBackend) Write(event *core.LogEvent) error
- func (fb *FilesystemBackend) WriteBatch(events []*core.LogEvent) error
- type FilesystemConfig
- type GCSBackend
- func (gb *GCSBackend) Close() error
- func (gb *GCSBackend) Name() string
- func (gb *GCSBackend) Read(_, _ time.Time) ([]*core.LogEvent, error)
- func (gb *GCSBackend) VerifyIntegrity() (*IntegrityReport, error)
- func (gb *GCSBackend) Write(event *core.LogEvent) error
- func (gb *GCSBackend) WriteBatch(events []*core.LogEvent) error
- type GCSConfig
- type IntegrityReport
- type Query
- type S3Backend
- func (s *S3Backend) Close() error
- func (s *S3Backend) GetStats() S3Stats
- func (s *S3Backend) Name() string
- func (s *S3Backend) Read(start, end time.Time) ([]*core.LogEvent, error)
- func (s *S3Backend) VerifyIntegrity() (*IntegrityReport, error)
- func (s *S3Backend) Write(event *core.LogEvent) error
- func (s *S3Backend) WriteBatch(events []*core.LogEvent) error
- type S3Config
- type S3Option
- type S3Stats
- type SyncMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureBackend ¶
type AzureBackend struct {
// contains filtered or unexported fields
}
AzureBackend implements the Backend interface for Azure Blob Storage
func NewAzureBackend ¶
func NewAzureBackend(cfg AzureConfig) (*AzureBackend, error)
NewAzureBackend creates a new Azure backend
func (*AzureBackend) VerifyIntegrity ¶
func (ab *AzureBackend) VerifyIntegrity() (*IntegrityReport, error)
VerifyIntegrity verifies the integrity of stored data
func (*AzureBackend) Write ¶
func (ab *AzureBackend) Write(event *core.LogEvent) error
Write writes an event to Azure
func (*AzureBackend) WriteBatch ¶
func (ab *AzureBackend) WriteBatch(events []*core.LogEvent) error
WriteBatch writes multiple events to Azure
type AzureConfig ¶
type AzureConfig struct {
Container string `json:"container"`
ConnectionString string `json:"connection_string"`
Prefix string `json:"prefix"`
AccessTier string `json:"access_tier"`
Immutable bool `json:"immutable"`
RetentionDays int `json:"retention_days"`
}
AzureConfig configures an Azure Blob Storage backend
func (AzureConfig) Type ¶
func (c AzureConfig) Type() string
Type returns the backend type identifier.
func (AzureConfig) Validate ¶
func (c AzureConfig) Validate() error
Validate validates the Azure configuration.
type Backend ¶
type Backend interface {
// Write writes an event to the backend
Write(event *core.LogEvent) error
// WriteBatch writes multiple events efficiently
WriteBatch(events []*core.LogEvent) error
// Read reads events within a time range
Read(start, end time.Time) ([]*core.LogEvent, error)
// VerifyIntegrity verifies the integrity of stored data
VerifyIntegrity() (*IntegrityReport, error)
// Name returns the backend name
Name() string
// Close closes the backend
Close() error
}
Backend defines the interface for storage backends
type BackendError ¶
BackendError represents a backend-specific error
func (*BackendError) Error ¶
func (e *BackendError) Error() string
func (*BackendError) Unwrap ¶
func (e *BackendError) Unwrap() error
type FilesystemBackend ¶
type FilesystemBackend struct {
// contains filtered or unexported fields
}
FilesystemBackend implements filesystem-based storage with redundancy
func NewFilesystemBackend ¶
func NewFilesystemBackend(config FilesystemConfig) (*FilesystemBackend, error)
NewFilesystemBackend creates a new filesystem backend
func (*FilesystemBackend) Close ¶
func (fb *FilesystemBackend) Close() error
Close closes the backend
func (*FilesystemBackend) Name ¶
func (fb *FilesystemBackend) Name() string
Name returns the backend name
func (*FilesystemBackend) VerifyIntegrity ¶
func (fb *FilesystemBackend) VerifyIntegrity() (*IntegrityReport, error)
VerifyIntegrity verifies the integrity of stored data
func (*FilesystemBackend) Write ¶
func (fb *FilesystemBackend) Write(event *core.LogEvent) error
Write writes an event to the filesystem
func (*FilesystemBackend) WriteBatch ¶
func (fb *FilesystemBackend) WriteBatch(events []*core.LogEvent) error
WriteBatch writes multiple events efficiently
type FilesystemConfig ¶
type FilesystemConfig struct {
Path string `json:"path"`
SyncMode SyncMode `json:"sync_mode"`
MaxSize int64 `json:"max_size"` // Max file size before rotation
MaxAge time.Duration `json:"max_age"` // Max age before rotation
Compress bool `json:"compress"` // Compress rotated files
Shadow bool `json:"shadow"` // Shadow copy for redundancy
}
FilesystemConfig configures a filesystem backend
func (FilesystemConfig) Type ¶
func (c FilesystemConfig) Type() string
Type returns the backend type identifier.
func (FilesystemConfig) Validate ¶
func (c FilesystemConfig) Validate() error
Validate validates the filesystem configuration.
type GCSBackend ¶
type GCSBackend struct {
// contains filtered or unexported fields
}
GCSBackend implements the Backend interface for Google Cloud Storage
func NewGCSBackend ¶
func NewGCSBackend(cfg GCSConfig) (*GCSBackend, error)
NewGCSBackend creates a new GCS backend
func (*GCSBackend) VerifyIntegrity ¶
func (gb *GCSBackend) VerifyIntegrity() (*IntegrityReport, error)
VerifyIntegrity verifies the integrity of stored data
func (*GCSBackend) Write ¶
func (gb *GCSBackend) Write(event *core.LogEvent) error
Write writes an event to GCS
func (*GCSBackend) WriteBatch ¶
func (gb *GCSBackend) WriteBatch(events []*core.LogEvent) error
WriteBatch writes multiple events to GCS
type GCSConfig ¶
type GCSConfig struct {
Bucket string `json:"bucket"`
ProjectID string `json:"project_id"`
Prefix string `json:"prefix"`
StorageClass string `json:"storage_class"`
Region string `json:"region"`
CredentialsFile string `json:"credentials_file"`
RetentionDays int `json:"retention_days"`
Versioning bool `json:"versioning"`
}
GCSConfig configures a Google Cloud Storage backend
type IntegrityReport ¶
type IntegrityReport struct {
Timestamp time.Time `json:"timestamp"`
Backend string `json:"backend"`
Errors []string `json:"errors,omitempty"`
TotalRecords int64 `json:"total_records"`
VerifiedRecords int64 `json:"verified_records"`
CorruptedRecords int64 `json:"corrupted_records"`
Valid bool `json:"valid"`
}
IntegrityReport contains integrity verification results
type Query ¶
type Query struct {
StartTime time.Time
EndTime time.Time
Filters map[string]interface{}
Limit int
}
Query represents a query for reading events
type S3Backend ¶
type S3Backend struct {
// contains filtered or unexported fields
}
S3Backend implements AWS S3 storage backend with compliance features
func NewS3Backend ¶
NewS3Backend creates a new S3 backend
func (*S3Backend) VerifyIntegrity ¶
func (s *S3Backend) VerifyIntegrity() (*IntegrityReport, error)
VerifyIntegrity verifies the integrity of S3 data
type S3Config ¶
type S3Config struct {
Bucket string `json:"bucket"`
Region string `json:"region"`
Prefix string `json:"prefix"`
StorageClass string `json:"storage_class"`
ServerSideEncryption bool `json:"server_side_encryption"`
Versioning bool `json:"versioning"`
ObjectLock bool `json:"object_lock"`
RetentionDays int `json:"retention_days"`
}
S3Config configures an S3 backend
type S3Option ¶
type S3Option func(*S3Backend)
S3Option configures S3 backend
func WithBatchSize ¶
WithBatchSize sets the batch size for writes
func WithKMSKeyID ¶
WithKMSKeyID sets the KMS key for encryption
func WithObjectLock ¶
WithObjectLock enables S3 Object Lock for compliance
func WithServerSideEncryption ¶
WithServerSideEncryption enables server-side encryption
func WithStorageClass ¶
WithStorageClass sets the S3 storage class