Name: log-cache
Owner: Cloud Foundry
Description: null
Created: 2017-11-14 18:25:08.0
Updated: 2018-05-23 22:47:07.0
Pushed: 2018-05-23 22:47:05.0
Homepage: null
Size: 451
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Log Cache persists data in memory from the Loggregator System.
This repository should be imported as:
import logcache "code.cloudfoundry.org/log-cache"
Log Cache indexes everything by the source_id
field on the Loggregator Envelope.
The source ID should distinguish the cluster from other clusters. It should not distinguish a specific instance.
In terms of Cloud Foundry, the source ID can either represent an application
guid (e.g. cf app <app-name> --guid
), or a component name (e.g. doppler
).
Each request must have the Authorization
header set with a UAA provided token.
If the token contains the doppler.firehose
scope, the request will be able
to read data from any source ID.
If the source ID is an app guid, the Cloud Controller is consulted to verify
if the provided token has the appropriate app access.
Shard groups can be used to split up consumption among multiple readers. With a shard group and set of requester IDs, Log Cache will do its best to evenly spread results among the requesters.
Log Cache implements a restful interface for getting data.
/v1/read/<source-id>
Get data from Log Cache for the given source-id
.
Query Parameters:
date +%s
). Start time is inclusive. [starttime..endtime)
date +%s
). End time is exclusive. [starttime..endtime)
LOG
, COUNTER
, GAUGE
, TIMER
, and EVENT
. If set, then only those
types of envelopes will be emitted. This parameter may be specified multiple times
to include more types. "http://<log-cache-addr>:8080/v1/read/<source-id>?start_time=<start-time>&end_time=<end-time>"
nvelopes": {"batch": [...] }
/v1/meta
Lists the available source IDs that Log Cache has persisted.
eta":{
"source-id-0":{"count":"100000","expired":"129452","oldestTimestamp":"1524071322998223702","newestTimestamp":"1524081739994226961"},
"source-id-1":{"count":"2114","oldestTimestamp":"1524057384976840476","newestTimestamp":"1524081729980342902"},
...
/v1/shard_group/<group-name>
Reads from the given shard-group. The shard-group's source-ids are merged and sorted.
Query Parameters:
date +%s
). Start time is inclusive. [starttime..endtime)
date +%s
). End time is exclusive. [starttime..endtime)
LOG
, COUNTER
, GAUGE
, TIMER
, and EVENT
. If set, then only those
types of envelopes will be emitted. This parameter may be specified multiple times
to include more types. "http://<log-cache-addr>:8080/v1/shard_group/<group-name>?start_time=<start-time>&end_time=<end-time>&requester_id=<requester-id>"
nvelopes": {"batch": [...] },
rgs": [...]
/v1/shard_group/<group-name>/
Adds the given source ids to the given shard-group. If the shard-group does
not exist, then it gets created. Each shard-group may contain many sub-groups.
Each sub-group may contain many source-ids. Each requester (identified by a
requester_id
) will receive an equal subset of the shard group. A sub-group
ensures that each requester receives envelopes for the given source-ids
grouped together (and not spread across other requesters). When setting a
shard-group, an arg
can also be provided. This arg will be returned when
reading back from the group. This gives context as to what data has been
read.
ourceIds": [
"source-id-1",
"source-id-2"
rg": "some-arg"
"http://<log-cache-addr>:8080/v1/shard_group/<group-name>" -XPUT -d'{"sourceIds":["source-id-1","source-id-2"]}'
/v1/shard_group/<group-name>/meta
Gets meta information about the shard-group.
"http://<log-cache-addr>:8080/v1/shard_group/<group-name>/meta"
ource_ids": [...],
equester_ids": [...],
rgs": [...]
/v1/promql
Issues a PromQL query against Log Cache data.
-G "http://<log-cache-addr>:8080/v1/promql" --data-urlencode 'query=metrics{source_id="source-id-1"}'
ector": {
"samples": [{ "metric": {...}, "point": {...} }]
Log Cache provides a plugin for the Cloud Foundry command line tool, which makes interacting with the API simpler.