Creating an Agent Configuration
Create an agent configuration in Logging to ingest metric data into a custom metric.
Agent configuration updates are detected and automatically loaded.
The agent configuration is created and appears in the Agent Configurations page. Use the oci logging agent-configuration create command and required parameters to create an agent configuration:
oci logging agent-configuration create compartment-id compartment_ocid --is-enabled [true|false] --service-configuration service_configuration [OPTIONS]
Example command and JSON filesoci logging agent-configuration create --description <description> \ --display-name <display_name> --group-association file://group-association.json \ --compartment-id <compartment_id> --is-enabled true \ --service-configuration file://create-service-configuration.json --wait-for-state SUCCEEDED --max-wait-seconds 60
group-association.json
:{ "groupList": [ "<dynamic_group_id>" ] }
create-service-configuration.json
:{ "configurationType": "MONITORING", "applicationConfigurations": [ { "sourceType": "KUBERNETES", "source": { "name": "KUBERNETES-uniqueid", "scrapeTargets": [ { "resourceType": "PODS", "k8sNamespace": "k8s-namespace" } ] }, "destination": { "compartmentId": "<compartment_id>", "metricsNamespace": "metricsnamespace" }, "filter": { "allowList": [ "regex-test" ], "denyList": [], "filterType": "KUBERNETES_FILTER", "name": "test" } } ] }
For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Run the CreateUnifiedAgentConfiguration operation to create an agent configuration.
Example API requestPOST /20200531/unifiedAgentConfigurations Host: https://logging.us-phoenix-1.oci.oraclecloud.com <authorization and other headers> { "serviceConfiguration": { "configurationType": "MONITORING", "applicationConfigurations": [ { "sourceType": "KUBERNETES", "source": { "name": "KUBERNETES-uniqueid", "scrapeTargets": [ { "resourceType": "PODS", "k8sNamespace": "k8s-namespace" } ] }, "destination": { "compartmentId": "<compartment_id>", "metricsNamespace": "metricsnamespace" }, "filter": { "allowList": [ "regex-test" ], "denyList": [], "filterType": "KUBERNETES_FILTER", "name": "test" } } ] }, "displayName": "mar-test", "isEnabled": true, "groupAssociation": { "groupList": [ "<dynamic_group_id>" ] }, "description": "test", "compartmentId": "<compartment_id>" }