Skip to content

HTTP Output

Defines an HTTP output to write TenXObject instance and template field values.

Configuration

To configure the HTTP output module, Edit these settings.

Below is the default configuration from: http/config.yaml (* Required Fields).

Edit Online

Edit config.yaml Locally

# 🔟❎ 'run' HTTP log4j2 output configuration

# Configure HTTP outputs to write TenXObject instance and template values.
# To learn more see https://doc.log10x.com/run/output/event/http/

# Set the 10x pipeline to 'run' 
tenx: run

# =============================== Dependencies ================================

include: run/modules/output/event/http

# ============================== HTTP Options =================================

# Multiple HTTP outputs can be defined below
outputHttp:

  # ----------------------------- Object Output ------------------------------

    # 'writeObjects' controls whether to write TenXObject field values to output.
  - writeObjects: false # (❗ REQUIRED)

    # ---------------------------- HTTP Options -----------------------------

    # 'url' sets the target HTTP host to write TenXObject instance/template values.
    #  For example, the URL below posts to the Datadog log intake endpoint:
    #  https://http-intake.logs.datadoghq.com/v1/input?host=myHost&ddsource=tenx&service=loggingApp&ddtags=env:Dev
    url: http://127.0.0.1:8000

    # 'headers' are added to each HTTP request. For example,
    #  'DD-API-KEY=TenXEnv.get("apiKey"),DD-APPLICATION-KEY=TenXEnv.get("appKey")
    #  can be used to authenticate the Datadog intake example above.
    headers: [
       Content-Type=application/json    
    ]

    #'method' sets the HTTP method to use (e.g. GET, POST, DELETE)  
    method: POST

    # --------------------------- Encoding Options ----------------------------

    # 'filter' sets a JavaScript expression that TenXObjects must evaluate as truthy to write to the output.
    #  To learn more see https://doc.log10x.com/run/output/regulate/#filter-expressions
    filter: isObject                          

    # 'fields' defines the fields to write for each TenXObject sent to this output.
    #  To learn more see https://doc.log10x.com/run/output/stream/#outputfields 
    fields: 
      - encode() 

    # 'encodeType' specifies how 'fields' are encoded to output. Possible values: [json,delimited].
    #  To learn more see https://doc.log10x.com/run/output/event/outputStream/#outputstreamencodetype
    encodeType: json      

  # ---------------------------- Template Output ----------------------------

    # The HTTP output below writes new template of TenXObjects written to http url. 
    # To learn more about TenXTemplates, see https://doc.log10x.com/run/template

    # ---------------------------General Options -----------------------------

    # 'writeTemplates' controls whether to write new templates to this output. 
  - writeTemplates: false # (❗ REQUIRED)

    # ---------------------------- HTTP Options -------------------------------

    url: http://127.0.0.1:8000

    # 'headers' are added to each HTTP request the output makes. 
    headers: [
       Content-Type=application/json    
    ]

    #'method' sets the HTTP method to use (e.g. GET, POST, DELETE)  
    method: POST

Options

Specify the options below to configure multiple HTTP output:

Name Description
outputHttpUrl Host HTTP/HTTPS address to connect and write to
outputHttpHeaders Request HTTP header pairs
outputHttpMethod HTTP request method
outputHttpFields List of TenXObject field names to encode
outputHttpFilter A JavaScript expression an TenXObject must evaluate as 'truthy' against to be written to this output
outputHttpWriteObjects If true, encode TenXObjects [outputHttpFields](https://doc.log10x.com/run/output/event/http/#outputhttpfields) to this output
outputHttpWriteTemplates If true, write new TenXTemplates to this output
outputHttpEncodeType The output format in which to encode TenXObject values. Possible values:[json, delimited]
outputHttpEncodedLinePrefix The line prefix prepended to the encoded event if 'outputHttpEncodeType' is 'delimited'
outputHttpEncodeDelimiter The delimiter placed between key and values pairs if 'outputHttpEncodeType' is 'delimited'

outputHttpUrl

Host HTTP/HTTPS address to connect and write to.

Type Required
String

Specifies an HTTP/HTTPS address to transmit TenXObject instance/template field values.

outputHttpHeaders

Request HTTP header pairs.

Type Default
List []

Specifies a list of HTTP header values to accompany requests in the form of = (e.g., header1=hello).

outputHttpMethod

HTTP request method.

Type Default
String POST

HTTP method to use (e.g., GET, POST, DELETE).

outputHttpFields

List of TenXObject field names to encode.

Type Default
List []

Specifies a list of TenXObject intrinsic/calculated/extracted field names to extract and write to the output.

outputHttpFilter

A JavaScript expression an TenXObject must evaluate as 'truthy' against to be written to this output.

Type Default
String ""

Specifies a JavaScript expression that an TenXObject must evaluate as truthy to write its field/template field values to this output. For example, 'outputHttpFilter: this.timestamp' will only emit timestamped TenXObjects.

outputHttpWriteObjects

If true, encode TenXObjects [outputHttpFields](https://doc.log10x.com/run/output/event/http/#outputhttpfields) to this output.

Type Default
String true

Determine whether to write outputHttpFields values of an TenXObject passed to this output. This configuration is typically defined using a JavaScript expression.

To enable/disable the output depending on whether a launch argument, environment variable, or JVM -D option evaluates as truthy, use:

  outputHttpWriteObjects: $=TenXEnv.get("myHttpAddress")

To learn more see TenXEnv.get.

outputHttpWriteTemplates

If true, write new TenXTemplates to this output.

Type Default
String false

Controls whether to write template values of TenXObjects passed to this output. The output will only emit TenXTemplates that the pipeline did not load at startup via the templateFile argument, and will only emit an TenXTemplate once based on itstemplateHash value.

outputHttpEncodeType

The output format in which to encode TenXObject values. Possible values:[json, delimited].

Type Default
String delimited

Specifies how to encode outputHttpFields values to this output. Possible values:

  • json: formats names and values for the current TenXObject as: {"field":"str","field2":1, "field3": true}
  • delimited: formats values for the current TenXObject as: "str",1,true The outputHttpEncodeDelimiter argument determines the separator to use.

outputHttpEncodedLinePrefix

The line prefix prepended to the encoded event if 'outputHttpEncodeType' is 'delimited'.

Type Default
String

Sets the char which is prepended to the emitted TenXObject field values when outputHttpEncodeType is delimited.

outputHttpEncodeDelimiter

The delimiter placed between key and values pairs if 'outputHttpEncodeType' is 'delimited'.

Type Default
String

Sets the char delimiter to separate TenXObject field values when outputHttpEncodeType is delimited.


This module is defined in http/module.yaml.