Ingesting with HTTP Event Collector (HEC)

Falcon LogScale's HEC API is an alternative HTTP ingest endpoint. It is capable of handling both structured and unstructured data, and is primarily provided for compatibility with Splunk.

The endpoints for HEC can be found at /api/v1/ingest/hec and /services/collector.

Data Format

Request payload is a series of whitespace delimited JSON objects, containing one or more of the following optional elements:

Member Description
time

Time in seconds since January 1, 1970 in UTC. This can be a integer or floating point number to support milliseconds. LogScale represents time with millisecond precision. Is translated to @timestamp on ingestion.

Times are interpreted as follows:

  • Integer — treated as seconds

  • Float/Double — treated as seconds plus milliseconds

  • String — parsed to an integer or float and then treated as above

timezone Can be used to describe the time zone in which the event happened. Defaults to Z (i.e., UTC). Translated to @timezone on ingestion.
index Optional name of the repository to ingest into. Translated to #repo tag on ingestion. In public-facing API's this must — if present — be equal to the repository used to create the ingest token used for authentication. In private cluster setups, LogScale can be configured to allow these to be different. See below.
sourcetype Translated to the #type tag on ingestion. If set, this is used to choose which LogScale parser to use for extracting fields.

To refer to a parser within the given repository just the name can be provided. To refer to the parser from a package installed into the repository, use the form PACKAGESCOPE/PACKAGENAME:PARSERNAME. For example, to use the apache_access within the apache/http-server package, use apache/http-server:apache_access.

source Translated to the @source metadata field on ingestion. Typically used to designate the path to the file that is being shipped to LogScale.
host Translated to the @host field on ingestion. Typically used to designate the origin host.
event This can be a JSON Object, a String, or an array. This will be translated into the @rawstring field in LogScale on ingestion. When this is a JSON Object, it is automatically parsed before any parser associated with the ingest token, so that all members of the object become accessible fields in LogScale. If it is a string containing key-value pairs, use the kv-generic parser to extract these into fields in LogScale. The key/value parser searches for data with the patterns key=value, key="value", or key='value'.
fields JSON object containing extra fields to the event. Tags #tags can be added to the event by specifying fields starting with #.

Note

All elements in the previous table are optional.

Authentication

You will need to provide a Ingest Tokens in the HTTP Authorization header.

The ingest token contains the name of the repository the data is stored in, and ingested events will be stored in the repository corresponding to the ingest token.

If using an Organization API Token with the Ingest across all repositories within organization permission, then HEC allows ingest to any repository specified as "index": "repository-name" in the body of a message, as long as the ingest token is valid for any repository on the LogScale cluster. If the named repository does not exist then an error will be returned.

This is a potential security issue on a public API endpoint, so this option should only be used inside a trusted environment.

Example

Below is an example of the sending a JSON document for ingest:

Show:
shell
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/ingest/hec \
    -H "Authorization: Bearer $INGEST_TOKEN" \
    -H "Content-Type: text/plain; charset=utf-8" \
    -d @- << EOF
{
  "time" : 1537537729.0,
  "event" : "Fri, 21 Sep 2018 13:48:49 GMT - system started name=webserver",
  "source" : "/var/log/application.log",
  "sourcetype" : "applog",
  "fields" : { "#env" : "prod" }
}

{
  "time" : 1537535729.0,
  "event" : {
    "message" : "System shutdown",
    "host" : { "ip" : "127.0.0.1", "port" : 2222 }
  },
  "fields" : { "#datacenter" : "amazon-east1" }
}
EOF

Data Handling for Large Data Events

The following examples detail the resulting ingested data for different raw event volumes. For more information on limits, see Limits & Standards.

Ingest Data within Limits

Show:
shell
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/ingest/hec \
    -H "Authorization: Bearer $INGEST_TOKEN" \
    -H "Content-Type: text/plain; charset=utf-8" \
    -d @- << EOF
{
    "fields": {
        "#someTag": "a-small-value",
        "someField1": "tiny-data-value",
        "someField2": "small-data-value"
    },
    "event": "also-a-tiny-data-value"
}
EOF
Example Responses
Show:
FieldValue
#repodeveloper
#typenone
@idL4tQKldzrldCwMCVc8PIq7Wp_0_0_1719304163
@ingesttimestamp1719304163717
@rawstringalso-a-tiny-data-value
@timestamp1719304163717
@timestamp.nanos0
@timezoneZ
#someTaga-small-value
someField1tiny-data-value
someField2small-data-value

All expected data and fields are present, and they are not truncated.

Raw String is Too Large

Show:
shell
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/ingest/hec \
    -H "Authorization: Bearer $INGEST_TOKEN" \
    -H "Content-Type: text/plain; charset=utf-8" \
    -d @- << EOF
{
    "fields": {
	"#someTag": "a-small-value",
        "someField1": "someValue1",
        "someField2": "someValue2"
    },
    "event": "... More than 1MB of data ..."
}
EOF
Example Responses
Show:
FieldValue
#errortrue
#repodeveloper
#typejson
@errortrue
@error_msgInput too big. Event truncated at 1048576
@error_msg[0]Input too big. Event truncated at 1048576
@idGveuGB8hexKWpraoahisoA46_0_0_1719301041
@ingesttimestamp1719301041888
@input_size1048677
@rawstringTruncated data
@timestamp1719301041888
@timestamp.nanos0
@timezoneZ
#someTaga-small-value

The someField1 and someField2 are not present, but #someTag is.

Field is Too Large

Show:
shell
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/ingest/hec \
    -H "Authorization: Bearer $INGEST_TOKEN" \
    -H "Content-Type: text/plain; charset=utf-8" \
    -d @- << EOF
{
    "fields": {
	"#someTag": "a-small-value",
        "someField1": "tiny-data-value",
        "someField2": "... More than 1MB of data ..."
    },
    "event": "also-a-tiny-data-value"
}
EOF
Example Responses
Show:
FieldValue
#errortrue
#repodeveloper
#typejson
@errortrue
@error_msgInput too big. Event truncated at 1048576
@error_msg[0]Input too big. Event truncated at 1048576
@idGveuGB8hexKWpraoahisoA46_1_1_1719303197
@ingesttimestamp1719303197844
@input_size1049579
@rawstringalso-a-tiny-data-value
@timestamp1719303197844
@timestamp.nanos0
@timezoneZ
#someTaga-small-value

The someField1 and someField2 are not present, but #someTag is.

Tag is Too Large

Show:
shell
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/ingest/hec \
    -H "Authorization: Bearer $INGEST_TOKEN" \
    -H "Content-Type: text/plain; charset=utf-8" \
    -d @- << EOF
{
    "fields": {
	"#someTag": "... More than 65535 bytes of data ...",
      "someField1": "tiny-data-value",
      "someField2": "small-data-value"
    },
    "event": "also-a-tiny-data-value"
}
EOF
Example Responses
Show:
none
Event data is too large

Entire request is dropped, no data in LogScale.