A Factorio mod to export realtime JSON/statsd statistics
Exposes the game API and regularly exports chosen metrics in a machine-readable way. Use the /stat test
commands to explore the game API, and /stat add
, /stat list
, /stat del
to manage the metrics being watched. Mod settings change the frequency (in game ticks) of JSON file output.
Metrics are named as if exploring the game API, starting with the game object.
For example, first test a metric is readable:
> /stat test game.players.1.online_time
game.players.1.online_time: 36709853
Let's try that with a wildcard:
> /stat test game.players.*.online_time
game.players.1.online_time: 36709853
game.players.2.online_time: 46921510
game.players.3.online_time: 144890
game.players.4.online_time: 619820
Wow, who's that person with no life?
> /stat test game.players.2.name
game.players.2.name: aoi44
Oh me. Let's watch this metric:
> /stat add game.players.*.online_time
Check in {GAME_DIR}/script-output/stats.json
:
{
"game.players.1.online_time":36709853,
"game.players.2.online_time":46927924,
"game.players.3.online_time":144890,
"game.players.4.online_time":619820
}
This file can be consumed by anything 🤓 Graphs, dashboards, alarms, tournaments...
More examples and guides are available on the homepage.
You might experience crashes or bugs. Multiplayer games allow all clients access to exported data (could be used for cheating). Please use carefully and report any problems!