我有一个在 AWS Graviton(arm、4 个 vCPU、8 GiB)上运行的 Loki 服务器,配置如下:
common:
replication_factor: 1
ring:
kvstore:
store: etcd
etcd:
endpoints: ['127.0.0.1:2379']
storage_config:
boltdb_shipper:
active_index_directory: /opt/loki/index
cache_location: /opt/loki/index_cache
shared_store: s3
aws:
s3: s3://ap-south-1/bucket-name
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h # 7d
ingestion_rate_mb: 10
ingestion_burst_size_mb: 20
per_stream_rate_limit: 8MB
ingester:
lifecycler:
join_after: 30s
chunk_block_size: 10485760
compactor:
working_directory: /opt/loki/compactor
shared_store: s3
compaction_interval: 5m
schema_config:
configs:
- from: 2022-01-01
store: boltdb-shipper
object_store: s3
schema: v11
index:
prefix: loki_
period: 24h
table_manager:
retention_period: 360h #15d
retention_deletes_enabled: true
index_tables_provisioning: …Run Code Online (Sandbox Code Playgroud) 对于同一个应用程序,我们有不同类型的日志。有些来自我们的应用程序,以 JSON 格式记录,有些则来自不同类型的日志消息。
例如这 3 行日志:
"{\"written_at\": \"2022-03-30T07:51:04.934Z\", \"written_ts\": 1648626664934052000, \"msg\": \"Step 'X' started at 2022-03-30 07:51:04\", \"type\": \"log\", \"logger\": \"my-logger\", \"thread\": \"MainThread\", \"level\": \"DEBUG\", \"module\": \"my.module\", \"line_no\": 48}\n"
" ERROR Data processing error: Did not work \n"
"FileNotFoundError: [Errno 2] No such file or directory: '/local.json'\n"
Run Code Online (Sandbox Code Playgroud)
为了解析应用程序 JSON 日志,我们执行以下 LogQL 查询:
| json log="log"
| line_format "{{.log}}"
| json | line_format "{{.msg}}"
| __error__ != "JSONParserErr"
Run Code Online (Sandbox Code Playgroud)
正如我们的查询已经指出的那样,我们无法解析其他行日志,因为它们不是 JSON 格式。
我们能否根据条件定义不同的解析和格式?或者作为 JSONParserErr 发生时的后备?
使用grafana和Influxdb,我试图显示一些计数器的每秒速率.如果我使用该non_negative_derivative(1s)函数,则速率的值似乎会根据grafana视图的时间宽度而发生显着变化.我正在使用last选择器(但也可以使用max哪个是相同的值,因为它是一个计数器).
具体来说,我正在使用:
SELECT non_negative_derivative(last("my_counter"), 1s) FROM ...
InfluxDB计算按时间顺序的字段值之间的差异,并将这些结果转换为每单位的变化率.
所以对我来说,这意味着在扩展时间视图时给定点的值不应该改变那么多,因为值应该是每单位的变化率(在我上面的示例查询中是1s).
在石墨中,它们具有特定的perSecond功能,效果更好:
perSecond(consolidateBy(my_counter, 'max'))
关于上面的涌入查询我做错了什么想法?
我正在探索grafana我的日志管理和系统监控.我发现kibana也用于相同的过程.我只是不知道何时使用kibana以及何时使用grafana以及何时使用zabbix?
我有一个带有模板变量的Grafana仪表板services和instances.当我选择一项服务时,如何根据第一个过滤第二个模板变量列表呢?
我的问题是不同的方式来连接mongodb与grafana
在我的项目中,我们使用 influx dB 和 Grafana 进行日志和其他在 Ubuntu 机器上运行的分析。最近,由于迁移过程,端口被阻止,例如 3000(用于 Grafana)和 8086(用于 influx dB),由于某些安全原因,这些端口将继续被阻止。所以,我无法通过浏览器和邮递员连接它们。
因此,作为解决方案,我们计划将这些(至少是仪表板)移动到本地设置。我检查了该进程是否已启动并正在运行。
但无法找到仪表板文件的物理位置。
我有一个默认设置,没有任何单独的 grafana 数据库配置。
[database]
# You can configure the database connection by specifying type, host, name, user and password
# as separate properties or as on string using the url properties.
# Either "mysql", "postgres" or "sqlite3", it's your choice
;type = sqlite3
;host = 127.0.0.1:3306
;name = grafana
;user = root
# If the password contains # or ; you have to wrap it …Run Code Online (Sandbox Code Playgroud) 我有一个 Spring boot 应用程序使用千分尺抛出开放指标统计数据。
对于每个 HTTP 端点,我可以看到以下指标,我认为该指标跟踪给定端点的请求数量:
http_server_requests_seconds_count
我的问题是如何在 Grafana 查询中使用它来显示每分钟调用我的端点的请求数?
我试过
http_client_requests_seconds_count{}
和
sum(rate(http_client_requests_seconds_count{}[1m]))
但两者都不起作用。
提前致谢。
grafana ×10
prometheus ×3
grafana-loki ×2
influxdb ×2
d3.js ×1
grafana-api ×1
javascript ×1
kibana ×1
logql ×1
metrics ×1
micrometer ×1
mongodb ×1
promql ×1
real-time ×1
spring ×1
time-series ×1
zabbix ×1