当前位置:网站首页>Istio practical skill: enable accesslog locally
Istio practical skill: enable accesslog locally
2022-06-24 15:20:00 【imroc】
This article comes from istio Learning notes
background
In the production environment , Sometimes we don't want to enable globally accesslog, Just want to be part of namespace or workload Enable accesslog, and istio Yes accesslog The configuration of is global , How to enable... For only some data faces accesslog Well ? The specific operation methods are described below .
As part namespace Enable accesslog
You can use the following Envoyfilter To achieve :
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: enable-accesslog
namespace: test # Just for test Namespace open accesslog
spec:
configPatches:
- applyTo: NETWORK_FILTER
match:
context: ANY
listener:
filterChain:
filter:
name: envoy.http_connection_manager
patch:
operation: MERGE
value:
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
access_log:
- name: envoy.access_loggers.file
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
path: "/dev/stdout"
log_format:
json_format:
authority: "%REQ(:AUTHORITY)%"
bytes_received: "%BYTES_RECEIVED%"
bytes_sent: "%BYTES_SENT%"
downstream_local_address: "%DOWNSTREAM_LOCAL_ADDRESS%"
downstream_remote_address: "%DOWNSTREAM_REMOTE_ADDRESS%"
duration: "%DURATION%"
method: "%REQ(:METHOD)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
protocol: "%PROTOCOL%"
request_id: "%REQ(X-REQUEST-ID)%"
requested_server_name: "%REQUESTED_SERVER_NAME%"
response_code: "%RESPONSE_CODE%"
response_flags: "%RESPONSE_FLAGS%"
route_name: "%ROUTE_NAME%"
start_time: "%START_TIME%"
upstream_cluster: "%UPSTREAM_CLUSTER%"
upstream_host: "%UPSTREAM_HOST%"
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
upstream_service_time: "%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%"
upstream_transport_failure_reason: "%UPSTREAM_TRANSPORT_FAILURE_REASON%"
user_agent: "%REQ(USER-AGENT)%"
x_forwarded_for: "%REQ(X-FORWARDED-FOR)%"- Tested version istio 1.8.
- If not specified
log_formatWill use Envoy Default Format String .
As part workload Enable accesslog
If you want to be accurate to the specified workload Enable accesslog, Can be in EnvoyFilter Add workloadSelector:
spec:
workloadSelector:
labels:
app: "nginx"Low version istio
Low version istio The use of envoy I won't support it v3 api, have access to v2:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: enable-accesslog
namespace: test # Just for test Namespace open accesslog
spec:
configPatches:
- applyTo: NETWORK_FILTER
match:
context: ANY
listener:
filterChain:
filter:
name: envoy.http_connection_manager
patch:
operation: MERGE
value:
typed_config:
"@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager"
access_log:
- name: envoy.file_access_log
config:
path: /dev/stdout边栏推荐
- Mots clés pour la cartographie es; Ajouter une requête par mot - clé à la requête term; Changer le type de mot - clé de cartographie
- Explore cloud native databases and take a broad view of future technological development
- Use list
- Sequential representation and implementation of linear table (refer to YanWeiMin version)
- leetcode 139. Word break word split (medium)
- 入行 4 年,跳槽 2 次,我摸透了软件测试这一行
- Record the range of data that MySQL update will lock
- Go language concurrency model mpg model
- The security market has entered a trillion era, and the security B2B online mall system has been accurately connected to deepen the enterprise development path
- Laravel8 uses faker to call factory to fill data
猜你喜欢
An accident caused by a MySQL misoperation, and the "high availability" cannot withstand it!

Virtual machines on the same distributed port group but different hosts cannot communicate with each other

Port conflict handling method for tongweb

leetcode. 12 --- integer to Roman numeral

Py's toad: a detailed introduction to toad, its installation and use

From pair to unordered_ Map, theory +leetcode topic practice

入行 4 年,跳槽 2 次,我摸透了软件测试这一行

leetcode.12 --- 整数转罗马数字

Laravel8 uses faker to call factory to fill data

从pair到unordered_map,理论+leetcode题目实战
随机推荐
Do you really know the difference between H5 and applet?
Alibaba OSS object storage service
Bitmap of redis data structure
一个简单而功能强大的开发者工具箱Box3.cc
API data interface for announcement of Hong Kong listed companies
Use dictionary
Six stones Management: garbage dump effect: if you don't manage your work, you will become a garbage dump
How to allow easydss online classroom system to upload an on-demand file with a space in the file name?
Chaos mesh in Tencent -- Tencent mutual entertainment chaotic engineering practice
Py's toad: a detailed introduction to toad, its installation and use
STM32F1与STM32CubeIDE编程实例-WS2812B全彩LED驱动(基于SPI+DMA)
Successfully solved: selenium common. exceptions. SessionNotCreatedException: Message: session not created: This versi
laravel 8 实现Auth登录
Carry forward the fine style of continuous operation and go all out to ensure the safety of Beijiang Levee
ESP32系列--ESP32各个系列对比
常见的缺陷管理工具——禅道,从安装到使用手把手教会你
Keyword of ES mapping; Term query add keyword query; Change mapping keyword type
FPGA based analog I ² C protocol system design (medium)
Who do you want to open a stock account? Is online account opening safe?
作为一名开发者,对你影响最深的书籍是哪一本?