Skip to content

Route Rule

Structure

{
  "route": {
    "rules": [
      {
        "inbound": [
          "local-in"
        ],
        "auth_user": [
          "jk"
        ],
        "path": [
          "/data/*.go"
        ],
        "path_suffix": [
          ".md"
        ],
        "path_prefix": [
          "/tmp/"
        ],
        "path_regex": [
          "^/var/log/.*\\.log$"
        ],
        "name": [
          "config.json"
        ],
        "name_regex": [
          "^.*\\.te?mp$"
        ],
        "file_type": [
          "regular"
        ],
        "min_size": "1B",
        "max_size": "10MB",
        "newer_than": "2025-01-01 00:00:00",
        "older_than": "2026-01-01 00:00:00",
        "user": [
          "jk"
        ],
        "user_id": [
          1000
        ],
        "invert": false,
        "action": "route",
        "outbound": "archive-out"
      }
    ]
  }
}

You can ignore the JSON Array [] tag when the content is only one item

Default Fields

The default rule uses the following matching logic: (path || path_suffix || path_prefix || path_regex || name || name_regex) && (file_type) && (min_size || max_size) && (newer_than || older_than) && (user || user_id) && other fields

inbound

Tags of Inbound.

auth_user

Username authenticated by the Remote inbound.

path

Match full file path using glob pattern.

path_suffix

Match file path suffix.

path_prefix

Match file path prefix.

path_regex

Match file path using regular expression.

name

Match file name. The name is the last element of the path.

name_regex

Match file name using regular expression.

file_type

Match file type.

Value Description
regular Regular file
dir Directory
symlink Symbolic link
fifo Named pipe
char Character device
block Block device
socket Unix domain socket

Not limited if empty.

min_size

Match files with size greater than or equal to the specified value.

Must be a positive integer followed by a unit: B, KB, MB, or GB.

max_size

Match files with size less than or equal to the specified value.

Must be a positive integer followed by a unit: B, KB, MB, or GB.

newer_than

Match files modified after the specified time.

Format: 2006-01-02 15:04:05.

older_than

Match files modified before the specified time.

Format: 2006-01-02 15:04:05.

user

Only supported on Linux and macOS.

Match file owner name.

user_id

Only supported on Linux and macOS.

Match file owner user ID.

invert

Invert match result.

action

Required

See Rule Actions for details.

outbound

The tag of the target outbound. Equivalent to action: "route" with route options.