indices

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogPolicyName             = "log-policy"
	LogIndexPrefix            = "logs-v0.5.1"
	LogIndexAlias             = "logs"
	LogIndexTemplateName      = "logs_rollover_mapping"
	PreProcessingPipelineName = "opni-ingest-pipeline"
)
View Source
const (
	ISMChangeVersion = "1.1.0"
)

Variables

View Source
var (
	OldIndexPrefixes = []string{
		"logs-v0.1.3*",
	}
	DefaultRetry = osapiext.RetrySpec{
		Count:   3,
		Backoff: "exponential",
		Delay:   "1m",
	}
	OpniLogPolicy = osapiext.ISMPolicySpec{
		ISMPolicyIDSpec: &osapiext.ISMPolicyIDSpec{
			PolicyID:   LogPolicyName,
			MarshallID: false,
		},
		Description:  "Opni policy with hot-warm-cold workflow",
		DefaultState: "hot",
		States: []osapiext.StateSpec{
			{
				Name: "hot",
				Actions: []osapiext.ActionSpec{
					{
						ActionOperation: &osapiext.ActionOperation{
							Rollover: &osapiext.RolloverOperation{
								MinIndexAge: "1d",
								MinSize:     "20gb",
							},
						},
					},
				},
				Transitions: []osapiext.TransitionSpec{
					{
						StateName: "warm",
					},
				},
			},
			{
				Name: "warm",
				Actions: []osapiext.ActionSpec{
					{
						ActionOperation: &osapiext.ActionOperation{
							ReplicaCount: &osapiext.ReplicaCountOperation{
								NumberOfReplicas: 0,
							},
						},
					},
					{
						ActionOperation: &osapiext.ActionOperation{
							IndexPriority: &osapiext.IndexPriorityOperation{
								Priority: 50,
							},
						},
					},
					{
						ActionOperation: &osapiext.ActionOperation{
							ForceMerge: &osapiext.ForceMergeOperation{
								MaxNumSegments: 1,
							},
						},
					},
				},
				Transitions: []osapiext.TransitionSpec{
					{
						StateName: "cold",
						Conditions: &osapiext.ConditionSpec{
							MinIndexAge: "2d",
						},
					},
				},
			},
			{
				Name: "cold",
				Actions: []osapiext.ActionSpec{
					{
						ActionOperation: &osapiext.ActionOperation{
							ReadOnly: &osapiext.ReadOnlyOperation{},
						},
					},
				},
				Transitions: []osapiext.TransitionSpec{
					{
						StateName: "delete",
						Conditions: &osapiext.ConditionSpec{
							MinIndexAge: "7d",
						},
					},
				},
			},
			{
				Name: "delete",
				Actions: []osapiext.ActionSpec{
					{
						ActionOperation: &osapiext.ActionOperation{
							Delete: &osapiext.DeleteOperation{},
						},
					},
				},
				Transitions: make([]osapiext.TransitionSpec, 0),
			},
		},
		ISMTemplate: []osapiext.ISMTemplateSpec{
			{
				IndexPatterns: []string{
					fmt.Sprintf("%s*", LogIndexPrefix),
				},
				Priority: 100,
			},
		},
	}

	OpniLogTemplate = osapiext.IndexTemplateSpec{
		TemplateName: LogIndexTemplateName,
		IndexPatterns: []string{
			fmt.Sprintf("%s*", LogIndexPrefix),
		},
		Template: osapiext.TemplateSpec{
			Settings: osapiext.TemplateSettingsSpec{
				NumberOfShards:   1,
				NumberOfReplicas: 1,
				ISMPolicyID:      LogPolicyName,
				RolloverAlias:    LogIndexAlias,
			},
			Mappings: osapiext.TemplateMappingsSpec{
				Properties: map[string]osapiext.PropertySettings{
					"timestamp": {
						Type: "date",
					},
					"time": {
						Type: "date",
					},
					"log": {
						Type: "text",
					},
					"masked_log": {
						Type: "text",
					},
					"log_type": {
						Type: "keyword",
					},
					"kubernetes_component": {
						Type: "keyword",
					},
				},
			},
		},
	}

	IngestPipelineTemplate = osapiext.IndexTemplateSpec{
		TemplateName: "logs-ingest-pipeline",
		IndexPatterns: []string{
			fmt.Sprintf("%s*", LogIndexPrefix),
		},
		Template: osapiext.TemplateSpec{
			Settings: osapiext.TemplateSettingsSpec{
				DefaultPipeline: PreProcessingPipelineName,
			},
		},
		Priority: 50,
	}

	PreprocessingPipeline = osapiext.IngestPipeline{
		Description: "Opni preprocessing ingest pipeline",
		Processors: []osapiext.Processor{
			{
				OpniPreProcessor: &osapiext.OpniPreProcessor{
					Field:       "log",
					TargetField: "masked_log",
				},
			},
		},
	}
)

Functions

This section is empty.

Types

type Reconciler

type Reconciler struct {
	// contains filtered or unexported fields
}

func NewReconciler

func NewReconciler(ctx context.Context, opniCluster *v1beta2.OpniCluster, c client.Client) *Reconciler

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile() (retResult *reconcile.Result, retErr error)

Jump to

Keyboard shortcuts

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