File Storage Overview
TheFILE_STORAGE connector writes MQTT messages to local CSV or JSON files. It provides simple persistence for logging, backups, and data export without requiring a database server.
File storage is ideal for simple logging, local backups, and exporting data for offline analysis. Use it when you don’t need a full database but want persistent records.
Basic Syntax
Connection Configuration
FILE_STORAGE_CONFIG Parameters
string
required
Directory path for storing files.
Storage Location Options
Storage Location Options
string
File name pattern.
{0} is replaced with the table name. Default: {0}.csv for CSV and {0}.json for JSON.{0} is the only placeholder. Others, such as {date}, are not supported: the connector fails when it writes. For daily files, publish to a table name that includes the date.Format
Format
Write Options
Write Options
Timestamp
Timestamp
string
Timestamp format string. Default:
yyyy-MM-dd HH:mm:ss.CLEAN Query Format
File storage connectors use the CLEAN format:table name is used in the file pattern with {0}.
Writing Data
- CSV Logging
- JSON Storage
- Multiple Files
- Backup Storage
Log sensor data to daily CSV files:Creates files like:
sensor_data_2025-01-15.csvAlternative: STORE IN with Models — Instead of writing EVENT queries, you can bind a model directly to this connector. Every See Data Storage Overview for the full STORE IN workflow.
PUBLISH MODEL call automatically inserts a row — no query needed:Reading Data
EVENTs also support read queries to retrieve data from stored files. Publish a message to the event’sSOURCE_TOPIC, and the query result is published to DESTINATION_TOPIC. File Storage read queries use the CLEAN format with filter, sort, and limit instead of SQL:
file/result/latest, where your actions or external clients can consume it.
CLEAN Read Operators
File Pattern Placeholders
{0} is the only supported placeholder. A pattern with others, such as {date}, fails when the connector writes.
Output Examples
CSV Output
JSON Output (JSON Lines format)
Troubleshooting
Permission Denied
Permission Denied
- Verify STORAGE_DIR exists
- Check write permissions on directory
- Ensure Coreflux process has access
File Not Created
File Not Created
- Verify STORAGE_DIR path is correct
- Check disk space is available
- Ensure directory is writable
Data Not Appearing
Data Not Appearing
- Verify SOURCE_TOPIC matches incoming messages
- Check QUERY syntax is correct
- Verify APPEND is set correctly
Connector fails to write
Connector fails to write
FILE_PATTERNaccepts only{0}(the table name). Remove other placeholders such as{date}.- For JSON,
MAX_RECORDScaps the file and drops the oldest records. Files are not rotated.
Next Steps
Data Storage Connectors Overview
Compare all storage options.
PostgreSQL Connector
Configure PostgreSQL database storage.

