Skip to content

Commit b14d27e

Browse files
committed
autoclean: clean network events (30 days by default).
We also document this in the listnetworkevents command itself. The test_autoclean_once was getting repetitive, so I cleaned that up too. Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: `autoclean` will remove networkevents after 30 days by default.
1 parent bbe6279 commit b14d27e

File tree

6 files changed

+305
-83
lines changed

6 files changed

+305
-83
lines changed

contrib/msggen/msggen/schema.json

Lines changed: 101 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,8 @@
18511851
"succeededpays",
18521852
"failedpays",
18531853
"paidinvoices",
1854-
"expiredinvoices"
1854+
"expiredinvoices",
1855+
"networkevents"
18551856
],
18561857
"description": [
18571858
"What subsystem to clean. Currently supported subsystems are:",
@@ -1860,7 +1861,8 @@
18601861
" * `failedpays`: payment attempts which did not succeed (`failed` in listpays `status`).",
18611862
" * `succeededpays`: payment attempts which succeeded (`complete` in listpays `status`).",
18621863
" * `expiredinvoices`: invoices which were not paid (and cannot be) (`expired` in listinvoices `status`).",
1863-
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status)."
1864+
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status).",
1865+
" * `networkevents`: all events in listnetworkevents (added *v25.12*)"
18641866
]
18651867
},
18661868
"age": {
@@ -2012,6 +2014,31 @@
20122014
]
20132015
}
20142016
}
2017+
},
2018+
"networkevents": {
2019+
"type": "object",
2020+
"additionalProperties": false,
2021+
"added": "v25.12",
2022+
"required": [
2023+
"cleaned",
2024+
"uncleaned"
2025+
],
2026+
"properties": {
2027+
"cleaned": {
2028+
"added": "v25.12",
2029+
"type": "u64",
2030+
"description": [
2031+
"Total number of deletions done this run."
2032+
]
2033+
},
2034+
"uncleaned": {
2035+
"added": "v25.12",
2036+
"type": "u64",
2037+
"description": [
2038+
"The total number of entries *not* deleted this run."
2039+
]
2040+
}
2041+
}
20152042
}
20162043
}
20172044
}
@@ -2086,7 +2113,8 @@
20862113
"succeededpays",
20872114
"failedpays",
20882115
"paidinvoices",
2089-
"expiredinvoices"
2116+
"expiredinvoices",
2117+
"networkevents"
20902118
],
20912119
"description": [
20922120
"What subsystem to ask about. Currently supported subsystems are:",
@@ -2095,7 +2123,8 @@
20952123
" * `failedpays`: payment attempts which did not succeed (`failed` in listpays `status`).",
20962124
" * `succeededpays`: payment attempts which succeeded (`complete` in listpays `status`).",
20972125
" * `expiredinvoices`: invoices which were not paid (and cannot be) (`expired` in listinvoices `status`).",
2098-
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status)."
2126+
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status).",
2127+
" * `networkevents`: all events in listnetworkevents (added *v25.12*)"
20992128
]
21002129
}
21012130
}
@@ -2481,6 +2510,72 @@
24812510
"cleaned": {}
24822511
}
24832512
}
2513+
},
2514+
"networkevents": {
2515+
"type": "object",
2516+
"added": "v25.12",
2517+
"additionalProperties": true,
2518+
"required": [
2519+
"enabled",
2520+
"cleaned"
2521+
],
2522+
"properties": {
2523+
"enabled": {
2524+
"type": "boolean",
2525+
"added": "v25.12",
2526+
"description": [
2527+
"Whether autocleaning is enabled for networkevents."
2528+
]
2529+
},
2530+
"cleaned": {
2531+
"type": "u64",
2532+
"added": "v25.12",
2533+
"description": [
2534+
"Total number of deletions done (ever)."
2535+
]
2536+
}
2537+
},
2538+
"if": {
2539+
"additionalProperties": true,
2540+
"properties": {
2541+
"enabled": {
2542+
"type": "boolean",
2543+
"enum": [
2544+
true
2545+
]
2546+
}
2547+
}
2548+
},
2549+
"then": {
2550+
"additionalProperties": false,
2551+
"required": [
2552+
"enabled",
2553+
"age",
2554+
"cleaned"
2555+
],
2556+
"properties": {
2557+
"enabled": {},
2558+
"cleaned": {},
2559+
"age": {
2560+
"added": "v25.12",
2561+
"type": "u64",
2562+
"description": [
2563+
"Age (in seconds) to clean networkevents."
2564+
]
2565+
}
2566+
}
2567+
},
2568+
"else": {
2569+
"additionalProperties": false,
2570+
"required": [
2571+
"enabled",
2572+
"cleaned"
2573+
],
2574+
"properties": {
2575+
"enabled": {},
2576+
"cleaned": {}
2577+
}
2578+
}
24842579
}
24852580
}
24862581
}
@@ -21841,7 +21936,8 @@
2184121936
"title": "Command for querying network events",
2184221937
"added": "v25.12",
2184321938
"description": [
21844-
"The **listnetworkevents** RPC command retrieves the log of connections, disconnections and pings on the network. This can be analyzed to evaluate node reliability and latency."
21939+
"The **listnetworkevents** RPC command retrieves the log of connections, disconnections and pings on the network. This can be analyzed to evaluate node reliability and latency.",
21940+
"Note: the `autoclean` plugin deletes network events older than 30 days; you can adjust `autoclean-networkevents-age` to change this"
2184521941
],
2184621942
"categories": [
2184721943
"readonly"

doc/schemas/autoclean-once.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"succeededpays",
2222
"failedpays",
2323
"paidinvoices",
24-
"expiredinvoices"
24+
"expiredinvoices",
25+
"networkevents"
2526
],
2627
"description": [
2728
"What subsystem to clean. Currently supported subsystems are:",
@@ -30,7 +31,8 @@
3031
" * `failedpays`: payment attempts which did not succeed (`failed` in listpays `status`).",
3132
" * `succeededpays`: payment attempts which succeeded (`complete` in listpays `status`).",
3233
" * `expiredinvoices`: invoices which were not paid (and cannot be) (`expired` in listinvoices `status`).",
33-
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status)."
34+
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status).",
35+
" * `networkevents`: all events in listnetworkevents (added *v25.12*)"
3436
]
3537
},
3638
"age": {
@@ -182,6 +184,31 @@
182184
]
183185
}
184186
}
187+
},
188+
"networkevents": {
189+
"type": "object",
190+
"additionalProperties": false,
191+
"added": "v25.12",
192+
"required": [
193+
"cleaned",
194+
"uncleaned"
195+
],
196+
"properties": {
197+
"cleaned": {
198+
"added": "v25.12",
199+
"type": "u64",
200+
"description": [
201+
"Total number of deletions done this run."
202+
]
203+
},
204+
"uncleaned": {
205+
"added": "v25.12",
206+
"type": "u64",
207+
"description": [
208+
"The total number of entries *not* deleted this run."
209+
]
210+
}
211+
}
185212
}
186213
}
187214
}

doc/schemas/autoclean-status.json

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"succeededpays",
1919
"failedpays",
2020
"paidinvoices",
21-
"expiredinvoices"
21+
"expiredinvoices",
22+
"networkevents"
2223
],
2324
"description": [
2425
"What subsystem to ask about. Currently supported subsystems are:",
@@ -27,7 +28,8 @@
2728
" * `failedpays`: payment attempts which did not succeed (`failed` in listpays `status`).",
2829
" * `succeededpays`: payment attempts which succeeded (`complete` in listpays `status`).",
2930
" * `expiredinvoices`: invoices which were not paid (and cannot be) (`expired` in listinvoices `status`).",
30-
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status)."
31+
" * `paidinvoices`: invoices which were paid (`paid` in listinvoices `status).",
32+
" * `networkevents`: all events in listnetworkevents (added *v25.12*)"
3133
]
3234
}
3335
}
@@ -413,6 +415,72 @@
413415
"cleaned": {}
414416
}
415417
}
418+
},
419+
"networkevents": {
420+
"type": "object",
421+
"added": "v25.12",
422+
"additionalProperties": true,
423+
"required": [
424+
"enabled",
425+
"cleaned"
426+
],
427+
"properties": {
428+
"enabled": {
429+
"type": "boolean",
430+
"added": "v25.12",
431+
"description": [
432+
"Whether autocleaning is enabled for networkevents."
433+
]
434+
},
435+
"cleaned": {
436+
"type": "u64",
437+
"added": "v25.12",
438+
"description": [
439+
"Total number of deletions done (ever)."
440+
]
441+
}
442+
},
443+
"if": {
444+
"additionalProperties": true,
445+
"properties": {
446+
"enabled": {
447+
"type": "boolean",
448+
"enum": [
449+
true
450+
]
451+
}
452+
}
453+
},
454+
"then": {
455+
"additionalProperties": false,
456+
"required": [
457+
"enabled",
458+
"age",
459+
"cleaned"
460+
],
461+
"properties": {
462+
"enabled": {},
463+
"cleaned": {},
464+
"age": {
465+
"added": "v25.12",
466+
"type": "u64",
467+
"description": [
468+
"Age (in seconds) to clean networkevents."
469+
]
470+
}
471+
}
472+
},
473+
"else": {
474+
"additionalProperties": false,
475+
"required": [
476+
"enabled",
477+
"cleaned"
478+
],
479+
"properties": {
480+
"enabled": {},
481+
"cleaned": {}
482+
}
483+
}
416484
}
417485
}
418486
}

doc/schemas/listnetworkevents.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"title": "Command for querying network events",
66
"added": "v25.12",
77
"description": [
8-
"The **listnetworkevents** RPC command retrieves the log of connections, disconnections and pings on the network. This can be analyzed to evaluate node reliability and latency."
8+
"The **listnetworkevents** RPC command retrieves the log of connections, disconnections and pings on the network. This can be analyzed to evaluate node reliability and latency.",
9+
"Note: the `autoclean` plugin deletes network events older than 30 days; you can adjust `autoclean-networkevents-age` to change this"
910
],
1011
"categories": [
1112
"readonly"

0 commit comments

Comments
 (0)