archive_logs

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 5 Imported by: 2

README

Archive logs

Compatible with Logz.io's archive logs API. You can archive logs to an AWS S3 bucket or Azure Blob Storage. Archiving gives you the option to restore logs and query them after they have expired from your time-based account. To create a new S3 archive:

client, _ := archive_logs.New(apiToken, apiServerAddress)
secretCredentials := archive_logs.S3SecretCredentialsObject{
                        AccessKey: "some-access-key",
                        SecretKey: "some-secret-key",
                    }
storageSettings := archive_logs.S3StorageSettings{
                            CredentialsType:     archive_logs.CredentialsTypeKeys,
                            Path:                "some-path",
                            S3SecretCredentials: &secretCredentials,
                        }
var createArchive archive_logs.CreateOrUpdateArchiving
createArchive.Compressed = new(bool)
*createArchive.Compressed = true
createArchive.Enabled = new(bool)
*createArchive.Enabled = true
createArchive.StorageType = archive_logs.StorageTypeS3
archive, err := client.SetupArchive(createArchive)
function func name
setup logs archive func (c *ArchiveLogsClient) SetupArchive(createArchive CreateOrUpdateArchiving) (*ArchiveLogs, error)
delete logs archive func (c *ArchiveLogsClient) DeleteArchiveLogs(archiveId int32) error
list logs archives func (c *ArchiveLogsClient) ListArchiveLog() ([]ArchiveLogs, error)
retrieve an archive func (c *ArchiveLogsClient) RetrieveArchiveLogsSetting(archiveId int32) (*ArchiveLogs, error)
update archives settings func (c *ArchiveLogsClient) UpdateArchiveLogs(archiveId int32, updateArchive CreateOrUpdateArchiving) (*ArchiveLogs, error)

Documentation

Index

Constants

View Source
const (
	StorageTypeS3       = "S3"
	StorageTypeBlob     = "BLOB"
	CredentialsTypeIam  = "IAM"
	CredentialsTypeKeys = "KEYS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveLogs

type ArchiveLogs struct {
	Id       int32           `json:"id"`
	Settings StorageSettings `json:"settings"`
}

type ArchiveLogsClient

type ArchiveLogsClient struct {
	*client.Client
}

func New

func New(apiToken string, baseUrl string) (*ArchiveLogsClient, error)

New Creates a new entry point into the archive logs functions, accepts the user's logz.io API token and base url

func (*ArchiveLogsClient) DeleteArchiveLogs

func (c *ArchiveLogsClient) DeleteArchiveLogs(archiveId int32) error

func (*ArchiveLogsClient) ListArchiveLog

func (c *ArchiveLogsClient) ListArchiveLog() ([]ArchiveLogs, error)

ListArchiveLog Returns all the archives for logs in an array associated with the account identified by the supplied API token, returns an error if any problem occurs during the API call

func (*ArchiveLogsClient) RetrieveArchiveLogsSetting

func (c *ArchiveLogsClient) RetrieveArchiveLogsSetting(archiveId int32) (*ArchiveLogs, error)

RetrieveArchiveLogsSetting gets an archive id and returns its settings or an error

func (*ArchiveLogsClient) SetupArchive

func (c *ArchiveLogsClient) SetupArchive(createArchive CreateOrUpdateArchiving) (*ArchiveLogs, error)

SetupArchive receives archive settings, and sends it as api request to logz.io returns an error if occurred

func (*ArchiveLogsClient) UpdateArchiveLogs

func (c *ArchiveLogsClient) UpdateArchiveLogs(archiveId int32, updateArchive CreateOrUpdateArchiving) (*ArchiveLogs, error)

UpdateArchiveLogs updates an existing logs archive

type BlobSettings

type BlobSettings struct {
	TenantId      string `json:"tenantId,omitempty"`      // required
	ClientId      string `json:"clientId,omitempty"`      // required
	ClientSecret  string `json:"clientSecret,omitempty"`  // required
	AccountName   string `json:"accountName,omitempty"`   // required
	ContainerName string `json:"containerName,omitempty"` // required
	Path          string `json:"path,omitempty"`
}

BlobSettings - use when StorageType is BLOB

type CreateOrUpdateArchiving

type CreateOrUpdateArchiving struct {
	StorageType              string             `json:"storageType"`                        // required
	Enabled                  *bool              `json:"enabled,omitempty"`                  // boolean - defined as a pointer because omitempty automatically omits false value
	Compressed               *bool              `json:"compressed,omitempty"`               // boolean - defined as a pointer because omitempty automatically omits false value
	AmazonS3StorageSettings  *S3StorageSettings `json:"amazonS3StorageSettings,omitempty"`  // Set as pointer so that on marshalling will omit empty
	AzureBlobStorageSettings *BlobSettings      `json:"azureBlobStorageSettings,omitempty"` // Set as pointer so that on marshalling will omit empty
}

type S3IamCredentials

type S3IamCredentials struct {
	Arn        string `json:"arn,omitempty"`        // required
	ExternalId string `json:"externalId,omitempty"` // only in response
}

S3IamCredentials - use when CredentialsType is IAM

type S3SecretCredentialsObject

type S3SecretCredentialsObject struct {
	AccessKey string `json:"accessKey,omitempty"` // required
	SecretKey string `json:"secretKey,omitempty"` // required
}

S3SecretCredentialsObject - use when CredentialsType is KEYS

type S3StorageSettings

type S3StorageSettings struct {
	CredentialsType     string                     `json:"credentialsType,omitempty"`     // required
	Path                string                     `json:"path,omitempty"`                // required
	S3SecretCredentials *S3SecretCredentialsObject `json:"s3SecretCredentials,omitempty"` // Set as pointer so that on marshalling will omit empty
	S3IamCredentials    *S3IamCredentials          `json:"s3IamCredentials,omitempty"`    // Set as pointer so that on marshalling will omit empty
}

S3StorageSettings - use when StorageType is S3

type StorageSettings

type StorageSettings struct {
	StorageType              string            `json:"storageType"` // required
	Enabled                  bool              `json:"enabled"`
	Compressed               bool              `json:"compressed"`
	AmazonS3StorageSettings  S3StorageSettings `json:"amazonS3StorageSettings"`
	AzureBlobStorageSettings BlobSettings      `json:"azureBlobStorageSettings"`
}

Jump to

Keyboard shortcuts

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