Skip to main content

Cloud Logs Tools

By enabling the logs Toolset, the assistant can manage Cloud Logs Spaces, Sinks, and Forwarders through MCP. For example, you can ask the assistant to send only CDN errors to a specific Space.

To enable it, put the following value in the X-Mcp-Toolsets header in your client settings:

X-Mcp-Toolsets: logs

If you also need Cloud Database at the same time, write logs,dbaas.

Main Concepts​

  • Space Where logs are stored, with a specific Region and retention period.
  • Sink A routing rule. A Sink sends matching logs to a Space or Forwarder.
  • Forwarder An external destination for sending logs: Splunk, HTTP, or Arvancloud Object Storage.
  • ARQL The filter language for inclusionRule and exclusionRule in a Sink.

The usual order is to first create the Space or Forwarder, and then connect the Sink to it.

Space Tools​

Use the following tools to manage Spaces:

ToolPurposeMain parameters
logs_space_listList Spacespage, perPage, q
logs_space_getDetails of a SpacespaceId
logs_space_createCreate a Spacename, region, retentionDays, description
logs_space_updateChange the description or retentionspaceId, description, retentionDays
logs_space_deleteRequest to delete a SpacespaceId

When creating a Space, follow these rules:

  • name must contain only letters, digits, and hyphens (-), and be unique in your account.
  • retentionDays must be between 1 and 400 days.
  • region is required; for example, ir-thr.

If you get a name error when creating a Space, Sink, or Forwarder, the name probably contains invalid characters or is a duplicate. Choose a unique name that contains only letters, digits, and hyphens.

Sink Tools​

Use the following tools to manage Sinks:

ToolPurposeMain parameters
logs_sink_listList Sinkspage, perPage, q
logs_sink_getDetails of a SinksinkId
logs_sink_createCreate a Sink for routing logsname, destinationType, destinationId, inclusionRule, exclusionRule, disabled
logs_sink_updateChange the description, ARQL rules, or enabled/disabled statussinkId, description, inclusionRule, exclusionRule, disabled
logs_sink_deleteDelete a SinksinkId

For destinationType, send one of the following two values:

ValueMeaning of destinationId
logSpaceName of the destination Space
logForwarderName of the destination Forwarder

Note that destinationId isn't a UUID; it's the name of the destination resource.

If you get a 422 error when creating or editing a Sink, the ARQL is invalid or the destination is wrong. Read the logs://docs/arql resource and fill destinationId with the destination's name.

Forwarder Tools​

Use the following tools to manage Forwarders:

ToolPurposeMain parameters
logs_forwarder_listList Forwarderspage, perPage, q
logs_forwarder_getDetails of a ForwarderforwarderId
logs_forwarder_createCreate a Forwardername, destinationType, destinationConfig
logs_forwarder_updateChange the description or destination settingsforwarderId, description, destinationConfig
logs_forwarder_deleteDelete a ForwarderforwarderId

In a Forwarder, destinationType is one of the following values, and each type needs its own fields in destinationConfig:

TypeRequired fields in destinationConfig
splunkendpoint, hecToken
httpendpoint; optional: basicAuthUsername, basicAuthPassword, headers
arvancloudStoragebucketName, region; optional: compressionMethod (uncompressed or gzip), hiveCompatiblePartitioning

Note that the destination type (destinationType) can't be changed after creation; you can only update the description and destination settings.

Writing Sink Rules with ARQL​

To write filter rules, the assistant can read the logs://docs/arql resource (named logs_arql). This resource explains the ARQL syntax and the meaning of inclusion and exclusion.

A Sink checks each log like this: if exclusionRule is set and the log matches it, the Sink rejects that log. If inclusionRule is set, only matching logs are accepted. Otherwise, the log is accepted.

You can use the following sample rules as a template:

severity == "ERROR" AND resource.type == "cdn"
resource.attributes.domain == "api.example.com"
NOT (payload.path == "/health" OR payload.path == "/ready")

More complete ARQL documentation is in the ARQL guide.

Ready-Made Prompt​

The logs_route_domain_logs prompt is a step-by-step guide for routing a domain's logs to a Space or Forwarder. Its main arguments are:

  • domain Enter the domain whose logs you're routing, such as api.example.com. This argument is required.
  • destination Specifies the destination type, which is one of space, splunk, http, or arvancloudStorage. This argument is required.
  • spaceName / region Enter the Space's name and Region. These arguments are required only when the destination is a Space.
  • forwarderName Enter the Forwarder's name. This argument is required only when the destination is a Forwarder.
  • endpoint / hecToken Enter the address and the token. These arguments are required for a Splunk or HTTP destination.
  • bucketName / storageRegion Enter the Object Storage bucket name and Region. These arguments are required for an Object Storage destination.

Common Scenarios​

Creating a Space and Checking Its Status​

Write in the chat:

Show me the list of my Logs Spaces.
Create a Space named prod-logs in region ir-thr with a retention of 30 days.

The assistant usually calls logs_space_list and then logs_space_create, and returns the spaceId.

Routing CDN Errors to a Space​

Write in the chat:

Create a Sink named cdn-errors that sends logs with severity ERROR and resource.type cdn
to the Space prod-logs. Read the ARQL resource before writing the rule.

The assistant first reads the logs://docs/arql resource and then runs logs_sink_create with these values:

  • destinationType: logSpace
  • destinationId: prod-logs
  • inclusionRule: for example, severity == "ERROR" AND resource.type == "cdn"

Sending Logs to Splunk or Object Storage​

Write in the chat:

Create a Forwarder splunk-prod: type splunk; ask me for the endpoint, and I'll give you the hecToken later.
Create a Forwarder s3-archive for arvancloudStorage: bucket my-logs-bucket, region ir-thr-at1, compression gzip.

After creating the Forwarder, create a Sink with destinationType=logForwarder and destinationId set to the Forwarder's name.

Routing a Domain's Logs with the Prompt​

Write in the chat:

Use the route domain logs prompt:
domain=api.example.com, destination=space, spaceName=prod-logs, region=ir-thr.

The assistant gets the logs_route_domain_logs prompt and creates or reuses the needed Space or Sink.

Updating and Deleting Safely​

Write in the chat:

Change the retention of the Space prod-logs to 60 days.
Temporarily disable the Sink cdn-errors.
Find the Space test-old. Before deleting, show its id and name and wait for my confirmation.

Note that deleting a Space, Sink, or Forwarder may not be reversible. If the assistant asks for confirmation and you aren't sure, don't confirm the operation.

Sample Client Configuration​

To make only the Cloud Logs tools available to the client, write the configuration as follows and replace YOUR-MACHINE-USER-UUID with your machine user's ID:

{
"mcpServers": {
"arvancloud": {
"url": "https://mcp.arvancloud.ir",
"headers": {
"Arvancloud-Api-Key": "apikey YOUR-MACHINE-USER-UUID",
"X-Mcp-Toolsets": "logs"
}
}
}
}

If you get a 401 error after connecting, the API key is invalid or empty; check the value of Arvancloud-Api-Key. If you see a 400 error on the MCP connection, the value of X-Mcp-Toolsets is empty or invalid, and you should set it to logs or logs,dbaas. If the Cloud Logs tools aren't shown, check the Toolset header and the machine user's permissions.

The details for Cursor, Claude, and OpenCode are in Client Setup. See more example chat sentences in Example Requests.