Lunar Commands
Discover
- Docker
- K8S
docker exec lunar-proxy discover
kubectl exec <lunar-proxy-pod-name> -- discover
Diagnose
The diagnose
command is used to inspect HAR logs collected by Lunar and exported to file. Running the command without any arguments prints the number of logs and the time of the last log. If an index i
is provided, the command will print the i
th log, ordered by time in ascending order.
caution
The diagnose
command only prints HAR logs which were exported to a file.
- Docker
- K8S
docker exec lunar-proxy diagnose
docker exec lunar-proxy diagnose <sample_index>
kubectl exec <lunar-proxy-pod-name> -- diagnose
kubectl exec <lunar-proxy-pod-name> -- diagnose <sample_index>
Examples:
$ diagnose
==== Diagnose ====
Inspect HAR samples exported by Lunar
Samples are ordered by time in ascending order
Usage: diagnose <sample-index>
Reading data from: /var/log/lunar-proxy/output.log
There are 4 samples
Last sample is from "2023-06-18T22:21:35.51002367Z"
$ diagnose 1
{
"log": {
"version": "1.2",
"creator": {
"name": "Lunar Har Exporter",
"version": "1.0",
"comment": ""
},
"entries": [
{
"startedDateTime": "2023-06-18T22:21:16.697899675Z",
# truncated for brevity, output continues
}
]
}
}
Apply Policies
- Docker
- K8S
docker exec lunar-proxy apply_policies
kubectl exec <lunar-proxy-pod-name> -- apply_policies
Remedy Stats
- Docker
- K8S
docker exec lunar-proxy remedy_stats
kubectl exec <lunar-proxy-pod-name> -- remedy_stats
Output Example:
{
"remedy_stats": [
{
"remedy": "response_based_throttling",
"action": "generated",
"affected_count": 5,
"affected_ratio": 0.23809,
"affected_stats_by_endpoint": [
{
"method": "POST",
"url": "some-api.com/v2/*",
"count": 5,
"count_by_status_code": {
"400": 5
}
}
]
},
{
"remedy": "strategy_based_throttling",
"action": "generated",
"affected_count": 3,
"affected_ratio": 0.14285,
"affected_stats_by_endpoint": [
{
"method": "GET",
"url": "another-api.com/{some-path-param}",
"count": 3,
"count_by_status_code": {
"429": 3
}
}
]
}
// further per-plugin statistics (e.g. `account_orchestration`)...
],
"remedy_action_stats": {
"generated": {
"count": 8,
"ratio": 0.38095,
"ratio_by_status_code": {
"419": 0.5
}
}
// further per-action statistics (e.g. `modified`)...
},
"max_epoch_millis": 1688394379367,
"min_epoch_millis": 1688394264386
}
Logs
- Docker
- K8S
docker logs lunar-proxy
kubectl logs <lunar-proxy-pod-name>