New Transparent capture is in preview. Record every app's traffic with no proxy configuration, on Windows, macOS and Linux. Learn more

fileAppendAction Action

Append text to a file for every matching exchange, with full support for captured variables in the output.

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.

When to use this action

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:

  • Recording every authentication failure to a file you can grep later.
  • Building a quick CSV of slow responses for offline analysis.
  • Sending one line per matched exchange to a tail target during a debugging session.
  • Capturing request bodies that contain a specific token for incident response.

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.

Real world examples

Log a CSV line for every 5xx response

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

Append the full URL and method on every POST to a sensitive path

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"

Write a UTF-16 line for tooling that expects it

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

Reference

fileAppendAction

Description

Write to a file. Captured variable are interpreted.

Evaluation scope

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.

YAML configuration name

fileAppendAction

Settings

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.

Example of usage

This filter has no specific usage example

.NET reference

View definition of FileAppendAction for .NET integration.

See also

The following actions are related to this action:

Frequently asked questions

Which variables can I use in the text property?

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.

Is the file rotated automatically?

No. fileAppendAction always appends. Use logrotate, an external tool, or a custom script if you need rotation.

What encoding does it use by default?

UTF-8. Override with the encoding property if you need something else, for example utf-16, ascii, or a specific code page.

Can I write to stdout instead of a file?

Yes, but use stdOutAction or stdErrAction. Those actions are tuned for stream output and avoid touching the filesystem.

Learn more about Fluxzy rules