A debugging proxy that cannot log to a file forces you to scrape the UI or write custom code. fileAppendAction keeps that workflow inside the rule file: pick the events with a filter, write the line you actually want, and let your usual tooling read the file. Combine it with setVariableAction for richer log lines.
Use fileAppendAction whenever you want a lightweight, file based audit trail that records exactly the fields you care about. Captured variables like {{authority.host}} or {{status.code}} are interpreted in the text template, so you can build CSV, JSON Lines, or freeform logs without writing a custom sink.
Typical situations include:
The action runs on the copySibling scope, which means it copies the scope of the triggering filter. Use runScope to pin the evaluation to a specific stage, for example responseHeaderReceivedFromRemote when you need the response status code in the line you write.
Easy way to keep an offline error trail across a long capture session.
rules:
- filter:
typeKind: StatusCodeServerErrorFilter
actions:
- typeKind: FileAppendAction
filename: /var/log/fluxzy/errors.csv
text: "{{authority.host}},{{request.path}},{{status.code}}\n"
runScope: ResponseHeaderReceivedFromRemote
A targeted audit log that only fires on writes to a specific endpoint family.
rules:
- filter:
typeKind: FilterCollection
operation: And
children:
- typeKind: HostFilter
pattern: api.internal.example.com
- typeKind: MethodFilter
methods:
- POST
actions:
- typeKind: FileAppendAction
filename: /var/log/fluxzy/writes.log
text: "{{request.method}} {{request.url}}\n"
Some legacy aggregation tools require a specific encoding. Set the encoding property to match.
rules:
- filter:
typeKind: HostFilter
pattern: legacy.example.com
actions:
- typeKind: FileAppendAction
filename: C:\logs\fluxzy.log
text: "{{authority.host}} {{request.path}}\r\n"
encoding: utf-16
Write to a file. Captured variable are interpreted.
Evaluation scope defines the timing where this filter will be applied.
copySibling Applied only on action. The action associated with this scope will copy his value from the triggering filter.
fileAppendAction
The following table describes the customizable properties available for this action:
| Property | Type | Description | DefaultValue |
|---|---|---|---|
| filename | string | Filename | |
| text | string | Text to write | |
| encoding | string | Default encoding. UTF-8 if not any. | |
| runScope | nullable`1 | When RunScope is defined. The action is only evaluated when the value of the scope occured. |
This filter has no specific usage example
View definition of FileAppendAction for .NET integration.
The following actions are related to this action:
Any variable Fluxzy exposes at the chosen scope: request method and path, authority host and port, status code, captured variables from setVariableAction, environment variables, and more. See the rule file syntax doc for the full list.
No. fileAppendAction always appends. Use logrotate, an external tool, or a custom script if you need rotation.
UTF-8. Override with the encoding property if you need something else, for example utf-16, ascii, or a specific code page.
Yes, but use stdOutAction or stdErrAction. Those actions are tuned for stream output and avoid touching the filesystem.