This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Send data to Apache Arrow Flight

Starting with version 4.26.0, the arrow-flight() destination can send data to an Apache Arrow Flight server over gRPC. Use this destination to deliver structured, columnar data to systems that accept Arrow Flight streams.

Prerequisites

  • An Apache Arrow Flight server that accepts the schema you configure.

Configuration

You define the columns and their types using the schema() option, and map each column to an AxoSyslog template or macro that is evaluated for every message routed to the destination. For example:

destination d_arrow_flight {
  arrow-flight(
    url("grpc://flight.example.com:8815")
    path("events.${HOST}")
    schema(
      "timestamp" TIMESTAMP => "${UNIXTIME}"
      "host"      STRING    => "${HOST}"
      "program"   STRING    => "${PROGRAM}"
      "severity"  INT64     => "${LEVEL_NUM}"
      "message"   STRING    => "${MSG}"
    )
    workers(4)
  );
};

Options

This destination has the following options:

batch-idle-timeout()

Type: time in milliseconds
Default: 0 (disabled)

Available in AxoSyslog 4.24 and later.

Description: batch-idle-timeout() measures the elapsed time since the last message was added to the batch (batch-timeout() defines the maximum time used to collect a batch, starting from the first message). If either batch-idle-timeout() or batch-timeout() expires, AxoSyslog closes and sends the batch.

batch-bytes()

Type: number [bytes]
Default: 0 (disabled)

Available in AxoSyslog version 4.26.0 and later.

Description: Sets the maximum size of the payload in a batch. If the size of the messages reaches this value, AxoSyslog sends the batch to the destination even if the number of messages is less than the value of the batch-lines() option. Setting batch-bytes() without setting batch-lines() removes the limit on the number of messages in a batch.

batch-lines()

Type: number
Default: 0

Description: Specifies how many lines are flushed to a destination in one batch. The AxoSyslog application waits for this number of lines to accumulate and sends them off in a single batch. Increasing this number increases throughput as more messages are sent in a single batch, but also increases message latency. To disable batch-lines(), set it to 0.

For example, if you set batch-lines() to 100, AxoSyslog waits for 100 messages.

If the batch-timeout() option is disabled, the AxoSyslog application flushes the messages if it has sent batch-lines() number of messages, or the queue became empty. If you stop or reload AxoSyslog or in case of network sources, the connection with the client is closed, AxoSyslog automatically sends the unsent messages to the destination.

Note that if the batch-timeout() option is enabled and the queue becomes empty, AxoSyslog flushes the messages only if batch-timeout() expires, or the batch reaches the limit set in batch-lines().

For optimal performance, make sure that the AxoSyslog source that feeds messages to this destination is configured properly: the value of the log-iw-size() / max-connections() of the source must be higher than the batch-lines() * workers() of the destination. Otherwise, the size of the batches cannot reach the batch-lines() limit.

batch-timeout()

Type: time in milliseconds
Default: -1 (disabled)

Description: Specifies the time AxoSyslog waits for lines to accumulate in the output buffer. The AxoSyslog application sends batches to the destinations evenly. The timer starts when the first message arrives to the buffer, so if only few messages arrive, AxoSyslog sends messages to the destination at most once every batch-timeout() milliseconds.

disk-buffer()

Description: This option enables putting outgoing messages into the disk buffer of the destination to avoid message loss in case of a system failure on the destination side. It has the following options:

capacity-bytes()

Type: number (bytes)
Default: 1MiB

Description: This is a required option. The maximum size of the disk-buffer in bytes. The minimum value is 1048576 bytes. If you set a smaller value, the minimum value will be used automatically. It replaces the old log-disk-fifo-size() option.

In AxoSyslog version 4.2 and earlier, this option was called disk-buf-size().

compaction()

Type: yes/no
Default: no

Description: If set to yes, AxoSyslog prunes the unused space in the LogMessage representation, making the disk queue size smaller at the cost of some CPU time. Setting the compaction() argument to yes is recommended when numerous name-value pairs are unset during processing, or when the same names are set multiple times.

dir()

Type: string
Default: N/A

Description: Defines the folder where the disk-buffer files are stored.

flow-control-window-bytes()

Type: number (bytes)
Default: 163840000

Description: Use this option if the option reliable() is set to yes. This option contains the size of the messages in bytes that is used in the memory part of the disk buffer. It replaces the old log-fifo-size() option. It does not inherit the value of the global log-fifo-size() option, even if it is provided. Note that this option will be ignored if the option reliable() is set to no.

In AxoSyslog version 4.2 and earlier, this option was called mem-buf-size().

flow-control-window-size()

Type: number(messages)
Default: 10000

Description: Use this option if the option reliable() is set to no. This option contains the number of messages stored in overflow queue. It replaces the old log-fifo-size() option. It inherits the value of the global log-fifo-size() option if provided. If it is not provided, the default value is 10000 messages. Note that this option will be ignored if the option reliable() is set to yes.

In AxoSyslog version 4.2 and earlier, this option was called mem-buf-length().

front-cache-size()

Type: number(messages)
Default: 1000

Description: The number of messages stored in the output buffer of the destination. Note that if you change the value of this option and the disk-buffer already exists, the change will take effect when the disk-buffer becomes empty.

Options reliable() and capacity-bytes() are required options.

In AxoSyslog version 4.2 and earlier, this option was called qout-size().

prealloc()

Type: yes/no
Default: no

Description:

By default, AxoSyslog doesn’t reserve the disk space for the disk-buffer file, since in a properly configured and sized environment the disk-buffer is practically empty, so a large preallocated disk-buffer file is just a waste of disk space. But a preallocated buffer can prevent other data from using the intended buffer space (and elicit a warning from the OS if disk space is low), preventing message loss if the buffer is actually needed. To avoid this problem, when using AxoSyslog 4.0 or later, you can preallocate the space for your disk-buffer files by setting prealloc(yes).

In addition to making sure that the required disk space is available when needed, preallocated disk-buffer files provide radically better (3-4x) performance as well: in case of an outage the amount of messages stored in the disk-buffer is continuously growing, and using large continuous files is faster, than constantly waiting on a file to change its size.

If you are running AxoSyslog on a dedicated host (always recommended for any high-volume settings), use prealloc(yes).

Available in AxoSyslog 4.0 and later.

reliable()

Type: yes/no
Default: no

Description: If set to yes, AxoSyslog cannot lose logs in case of reload/restart, unreachable destination or AxoSyslog crash. This solution provides a slower, but reliable disk-buffer option. It is created and initialized at startup and gradually grows as new messages arrive. If set to no, the normal disk-buffer will be used. This provides a faster, but less reliable disk-buffer option.

truncate-size-ratio()

Type: number((between 0 and 1))
Default: 1 (do not truncate)

Description: Limits the truncation of the disk-buffer file. Truncating the disk-buffer file can slow down the disk IO operations, but it saves disk space. By default, AxoSyslog version 4.0 and later doesn’t truncate disk-buffer files by default (truncate-size-ratio(1)). Earlier versions freed the disk-space when at least 10% of the disk-buffer file could be freed (truncate-size-ratio(0.1)).

AxoSyslog only truncates the file if the possible disk gain is more than truncate-size-ratio() times capacity-bytes().

  • Smaller values free disk space quicker.
  • Larger ratios result in better performance.

If you want to avoid performance fluctuations:

Example: Examples for using disk-buffer()

In the following case reliable disk-buffer() is used.

destination d_demo {
    network(
        "127.0.0.1"
        port(3333)
        disk-buffer(
            flow-control-window-bytes(10000)
            capacity-bytes(2000000)
            reliable(yes)
            dir("/tmp/disk-buffer")
        )
    );
};

In the following case normal disk-buffer() is used.

destination d_demo {
    network(
        "127.0.0.1"
        port(3333)
            disk-buffer(
            flow-control-window-size(10000)
            capacity-bytes(2000000)
            reliable(no)
            dir("/tmp/disk-buffer")
        )
    );
};

frac-digits()

Type: number
Default: 0

Description: The AxoSyslog application can store fractions of a second in the timestamps according to the ISO8601 format. The frac-digits() parameter specifies the number of digits stored. The digits storing the fractions are padded by zeros if the original timestamp of the message specifies only seconds. Fractions can always be stored for the time the message was received.

hook-commands()

Description: This option makes it possible to execute external programs when the relevant driver is initialized or torn down. The hook-commands() can be used with all source and destination drivers with the exception of the usertty() and internal() drivers.

Using hook-commands() when AxoSyslog starts or stops

To execute an external program when AxoSyslog starts or stops, use the following options:

startup()

Type: string
Default: N/A

Description: Defines the external program that is executed as AxoSyslog starts.

shutdown()

Type: string
Default: N/A

Description: Defines the external program that is executed as AxoSyslog stops.

Using the hook-commands() when AxoSyslog reloads

To execute an external program when the AxoSyslog configuration is initiated or torn down, for example, on startup/shutdown or during a AxoSyslog reload, use the following options:

setup()

Type: string
Default: N/A

Description: Defines an external program that is executed when the AxoSyslog configuration is initiated, for example, on startup or during a AxoSyslog reload.

teardown()

Type: string
Default: N/A

Description: Defines an external program that is executed when the AxoSyslog configuration is stopped or torn down, for example, on shutdown or during a AxoSyslog reload.

Example: Using hook-commands() with a network source

In the following example, the hook-commands() is used with the network() driver and it opens an iptables port automatically as AxoSyslog is started/stopped.

The assumption in this example is that the LOGCHAIN chain is part of a larger ruleset that routes traffic to it. Whenever the AxoSyslog created rule is there, packets can flow, otherwise the port is closed.

source {
    network(transport(udp)
    hook-commands(
          startup("iptables -I LOGCHAIN 1 -p udp --dport 514 -j ACCEPT")
          shutdown("iptables -D LOGCHAIN 1")
        )
     );
};

local-time-zone()

Type: name of the timezone, or the timezone offset
Default: The local timezone.

Description: Sets the timezone used when expanding filename and tablename templates.

The timezone can be specified by using the name, for example, time-zone("Europe/Budapest")), or as the timezone offset in +/-HH:MM format, for example, +01:00). On Linux and UNIX platforms, the valid timezone names are listed under the /usr/share/zoneinfo directory.

log-fifo-size()

Type: number
Default: Use global setting.

Description: The number of messages that the output queue can store.

path()

Type: template
Default:

Description: The descriptor path that identifies the dataset (for example, a table) on the Flight server. The path() option is templatable, so a single destination can route messages to multiple datasets based on the content of each message. For example:

path("events.${HOST}")

When path() resolves to different values for different messages, AxoSyslog uses it as the default value of the worker-partition-key() option, so that each batch contains messages belonging to the same path.

persist-name()

Type: string
Default: N/A

Description: If you receive the following error message during AxoSyslog startup, set the persist-name() option of the duplicate drivers:

Error checking the uniqueness of the persist names, please override it with persist-name option. Shutting down.

This error happens if you use identical drivers in multiple sources, for example, if you configure two file sources to read from the same file. In this case, set the persist-name() of the drivers to a custom string, for example, persist-name("example-persist-name1").

retries()

Type: number (of attempts)
Default: 3

Description: If AxoSyslog cannot send a message, it will try again until the number of attempts reaches retries().

If the number of attempts reaches retries(), AxoSyslog will wait for time-reopen() time, then tries sending the message again.

schema()

Type: arrow list
Default:

Description: Sets the columns of the data sent to the Flight server. This option is required. On the left side of the arrow (=>), set the name of the column and its type. On the right side, set any AxoSyslog template or macro, which is evaluated for each message routed to the destination. For example:

schema(
  "timestamp" TIMESTAMP => "${UNIXTIME}"
  "host"      STRING    => "${HOST}"
  "severity"  INT64     => "${LEVEL_NUM}"
  "message"   STRING    => "${MSG}"
  "labels"    MAP(STRING STRING) => "${MSG}"
)

The following column types are available:

Type Aliases Description
STRING UTF-8 string. This is the default type if you omit the type keyword.
INT64 INTEGER 64-bit signed integer.
DOUBLE FLOAT64 Double-precision floating-point number.
BOOL BOOLEAN Boolean value.
TIMESTAMP Timestamp value.
MAP(STRING STRING) Map with string keys and string values.

send-time-zone()

Accepted values: name of the timezone, or the timezone offset
Default: local timezone

Description: Specifies the time zone associated with the messages sent by syslog-ng, if not specified otherwise in the message or in the destination driver. For details, see Timezones and daylight saving.

The timezone can be specified by using the name, for example, time-zone("Europe/Budapest")), or as the timezone offset in +/-HH:MM format, for example, +01:00). On Linux and UNIX platforms, the valid timezone names are listed under the /usr/share/zoneinfo directory.

throttle()

Type: number
Default: 0

Description: Sets the maximum number of messages sent to the destination per second. Use this output-rate-limiting functionality only when using disk-buffer as well to avoid the risk of losing messages. Specifying 0 or a lower value sets the output limit to unlimited.

timeout()

Type: number [seconds]
Default: 0 (no timeout)

Available in AxoSyslog version 4.26.0 and later.

Description: Sets the timeout for the gRPC requests sent to the Flight server. Set it to 0 to disable the timeout.

url()

Type: string
Default:

Description: The address of the Apache Arrow Flight server, for example, grpc://flight.example.com:8815. If you omit the scheme from the URL (like flight.example.com:8815), AxoSyslog assumes grpc://.

workers()

Type: integer
Default: 1

Description: Specifies the number of worker threads (at least 1) that AxoSyslog uses to send messages to the server. Increasing the number of worker threads can drastically improve the performance of the destination.

worker-partition-autoscaling()

Type: yes, no
Default: no

Available in version 4.21 and later.

When using worker-partition-key() to categorize messages into different batches, the messages are hashed into workers by default. This prevents distributing across workers based on load.

Setting worker-partition-autoscaling(yes) uses a 1-minute statistic to distribute high-traffic partitions among multiple workers, allowing each worker to maximize its batch size. When using worker-partition-autoscaling(yes), set the number of workers() to higher than the expected number of partitions.

worker-partition-buckets()

Type: template
Default:

Description: The worker-partition-buckets() option determines the number of worker threads used for the worker-partition-key(). Note that the number set by worker-partition-buckets() should be lower than the number of workers().

worker-partition-key()

Type: template
Default: value of path()

Description: The worker-partition-key() option specifies a template: messages that expand the template to the same value are mapped to the same partition. When batching is enabled and multiple workers() are configured, only messages that belong to the same path() should be added to the same batch. By default, AxoSyslog uses the path() template as the partition key, so you only need to set worker-partition-key() explicitly if you want to partition messages differently.

For example, you can partition messages based on the source host:

worker-partition-key("${HOST}")