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
inclusionRuleandexclusionRulein 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:
| Tool | Purpose | Main parameters |
|---|---|---|
logs_space_list | List Spaces | page, perPage, q |
logs_space_get | Details of a Space | spaceId |
logs_space_create | Create a Space | name, region, retentionDays, description |
logs_space_update | Change the description or retention | spaceId, description, retentionDays |
logs_space_delete | Request to delete a Space | spaceId |
When creating a Space, follow these rules:
namemust contain only letters, digits, and hyphens (-), and be unique in your account.retentionDaysmust be between 1 and 400 days.regionis 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:
| Tool | Purpose | Main parameters |
|---|---|---|
logs_sink_list | List Sinks | page, perPage, q |
logs_sink_get | Details of a Sink | sinkId |
logs_sink_create | Create a Sink for routing logs | name, destinationType, destinationId, inclusionRule, exclusionRule, disabled |
logs_sink_update | Change the description, ARQL rules, or enabled/disabled status | sinkId, description, inclusionRule, exclusionRule, disabled |
logs_sink_delete | Delete a Sink | sinkId |
For destinationType, send one of the following two values:
| Value | Meaning of destinationId |
|---|---|
logSpace | Name of the destination Space |
logForwarder | Name of the destination Forwarder |
Note that
destinationIdisn'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:
| Tool | Purpose | Main parameters |
|---|---|---|
logs_forwarder_list | List Forwarders | page, perPage, q |
logs_forwarder_get | Details of a Forwarder | forwarderId |
logs_forwarder_create | Create a Forwarder | name, destinationType, destinationConfig |
logs_forwarder_update | Change the description or destination settings | forwarderId, description, destinationConfig |
logs_forwarder_delete | Delete a Forwarder | forwarderId |
In a Forwarder, destinationType is one of the following values, and each type needs its own fields in destinationConfig:
| Type | Required fields in destinationConfig |
|---|---|
splunk | endpoint, hecToken |
http | endpoint; optional: basicAuthUsername, basicAuthPassword, headers |
arvancloudStorage | bucketName, 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, orarvancloudStorage. 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:logSpacedestinationId:prod-logsinclusionRule: 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.