Machine Group
Log Service manages all the ECS instances whose logs need to be collected by using the Logtail client in the form of machine groups. Refer to details
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const _default = new random.index.Integer("default", {
max: 99999,
min: 10000,
});
const example = new alicloud.log.Project("example", {
projectName: `terraform-example-${_default.result}`,
description: "terraform-example",
});
const exampleMachineGroup = new alicloud.log.MachineGroup("example", {
project: example.projectName,
name: "terraform-example",
identifyType: "ip",
topic: "terraform",
identifyLists: [
"10.0.0.1",
"10.0.0.2",
],
});
Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
default = random.index.Integer("default",
max=99999,
min=10000)
example = alicloud.log.Project("example",
project_name=f"terraform-example-{default['result']}",
description="terraform-example")
example_machine_group = alicloud.log.MachineGroup("example",
project=example.project_name,
name="terraform-example",
identify_type="ip",
topic="terraform",
identify_lists=[
"10.0.0.1",
"10.0.0.2",
])
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var @default = new Random.Index.Integer("default", new()
{
Max = 99999,
Min = 10000,
});
var example = new AliCloud.Log.Project("example", new()
{
ProjectName = $"terraform-example-{@default.Result}",
Description = "terraform-example",
});
var exampleMachineGroup = new AliCloud.Log.MachineGroup("example", new()
{
Project = example.ProjectName,
Name = "terraform-example",
IdentifyType = "ip",
Topic = "terraform",
IdentifyLists = new[]
{
"10.0.0.1",
"10.0.0.2",
},
});
});
Content copied to clipboard
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Max: 99999,
Min: 10000,
})
if err != nil {
return err
}
example, err := log.NewProject(ctx, "example", &log.ProjectArgs{
ProjectName: pulumi.Sprintf("terraform-example-%v", _default.Result),
Description: pulumi.String("terraform-example"),
})
if err != nil {
return err
}
_, err = log.NewMachineGroup(ctx, "example", &log.MachineGroupArgs{
Project: example.ProjectName,
Name: pulumi.String("terraform-example"),
IdentifyType: pulumi.String("ip"),
Topic: pulumi.String("terraform"),
IdentifyLists: pulumi.StringArray{
pulumi.String("10.0.0.1"),
pulumi.String("10.0.0.2"),
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.integerArgs;
import com.pulumi.alicloud.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.alicloud.log.MachineGroup;
import com.pulumi.alicloud.log.MachineGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var default_ = new Integer("default", IntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var example = new Project("example", ProjectArgs.builder()
.projectName(String.format("terraform-example-%s", default_.result()))
.description("terraform-example")
.build());
var exampleMachineGroup = new MachineGroup("exampleMachineGroup", MachineGroupArgs.builder()
.project(example.projectName())
.name("terraform-example")
.identifyType("ip")
.topic("terraform")
.identifyLists(
"10.0.0.1",
"10.0.0.2")
.build());
}
}
Content copied to clipboard
resources:
default:
type: random:integer
properties:
max: 99999
min: 10000
example:
type: alicloud:log:Project
properties:
projectName: terraform-example-${default.result}
description: terraform-example
exampleMachineGroup:
type: alicloud:log:MachineGroup
name: example
properties:
project: ${example.projectName}
name: terraform-example
identifyType: ip
topic: terraform
identifyLists:
- 10.0.0.1
- 10.0.0.2
Content copied to clipboard
Module Support
You can use the existing sls-logtail module to create logtail config, machine group, install logtail on ECS instances and join instances into machine group one-click.
Import
Log machine group can be imported using the id, e.g.
$ pulumi import alicloud:log/machineGroup:MachineGroup example tf-log:tf-machine-group
Content copied to clipboard
Properties
Link copied to clipboard
The specific machine identification, which can be an IP address or user-defined identity.
Link copied to clipboard
The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard