Back to Apisix

APISIX variable

docs/en/latest/apisix-variable.md

3.16.03.4 KB
Original Source
<!-- # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # -->

Description

Besides NGINX variable, APISIX also provides additional variables.

List of variables

Variable NameOriginDescriptionExample
balancer_ipcoreThe IP of picked upstream server.192.168.1.2
balancer_portcoreThe port of picked upstream server.80
consumer_namecoreUsername of Consumer.
consumer_group_idcoreGroup ID of Consumer.
graphql_namecoreThe operation name of GraphQL.HeroComparison
graphql_operationcoreThe operation type of GraphQL.mutation
graphql_root_fieldscoreThe top level fields of GraphQL.["hero"]
mqtt_client_idmqtt-proxyThe client id in MQTT protocol.
route_idcoreId of Route.
route_namecoreName of Route.
service_idcoreId of Service.
service_namecoreName of Service.
redis_cmd_lineRedisThe content of Redis command.
resp_bodycoreIn the logger plugin, if some of the plugins support logging of response body, for example by configuring include_resp_body: true, then this variable can be used in the log format.
rpc_timexRPCTime spent at the rpc request level.

You can also register your own variable.