NXLog Legacy Documentation

Google Chronicle (om_chronicle)

Google Chronicle is a cloud service built as a specialized layer on top of the core Google infrastructure. It is designed for enterprises to privately retain, analyze, and search the massive amounts of security and network telemetry they generate. Chronicle normalizes, indexes, correlates, and analyzes the data to provide instant analysis and context on risky activity.

The Chronicle Ingestion API enables you to forward logs directly to Chronicle. This module supports forwarding unstructured logs to the v1/unstructuredlogentries endpoint. It will connect to the specified URL in either plain HTTP or HTTPS mode. Event data is sent in batches, reducing HTTP response latency, thus improving the data throughput.

This module does not currently support sending Unified Data Model (UDM) events to the udmevents endpoint. Refer to the Google Chronicle integration guide for how you can forward UDM events using the HTTP(s) (om_http) module.
To examine the supported platforms, see the list of installer packages in the Available Modules chapter.

Unstructured logs output format

om_chronicle forwards log records over HTTP(S) as JSON payload in the following format:

{
  "log_type": "<log_type>",
  "customer_id": "<customer_id>",
  "entries": [
    {
      "log_text": "<json_escaped_raw_event>",
      "ts_rfc3339": "<event_time>"
    }
  ]
}

For example:

{
  "log_type": "BIND_DNS",
  "customer_id": "c8c65bfa-5f2c-42d4-9189-64bb7b939f2c",
  "entries": [
    {
      "log_text": "26-Feb-2019 13:37:04.523 client 10.50.100.33#1116: query: examplepetstore.com IN A + (203.0.113.102)",
      "ts_rfc3339": "2019-26-02T13:37:04.523-08:00"
    },
    {
      "log_text": "26-Feb-2019 13:39:01.115 client 10.1.2.3#3333: query: www.example.com IN A + (203.0.113.102)"
    }
  ]
}

Required fields:

  • log_type is the value specified by the LogType directive.

  • log_text is the JSON escaped value of the $raw_event field.

Optional fields:

  • customer_id is present if the CustomerId directive is specified.

  • ts_rfc3339 is present if the $EventReceivedTime core field is present. If this field is not required, use the delete() procedure to remove $EventReceivedTime. This can be useful if the log text already contains a received date and time.

Additional metadata, including the NXLog-specific fields $SourceModuleName and $SourceModuleType, will not be included in the output unless these values have been written to the $raw_event field. The processing required to achieve this depends on the format of the input data. For example, if the input data is in JSON format, you need to:

  1. Use parse_json() to parse $raw_event into fields.

  2. Create and populate any additional custom fields.

  3. Use to_json() to convert the fields to JSON format and update the value of $raw_event.

Configuration

The om_chronicle module accepts the following directives in addition to the common module directives. The URL and LogType directives are required.

URL

This mandatory directive specifies the v1 endpoint URL for the module to POST the event data. See the Examples below.

Multiple URL directives as a failover configuration are not supported at this time.
Sending logs to the v2/unstructuredlogentries:batchCreate endpoint with OAuth 2.0 authentication is not supported yet.

The module operates in plain HTTP or HTTPS mode depending on the URL provided. If the port number is not explicitly defined in the URL, it defaults to port 80 for HTTP and port 443 for HTTPS.

LogType

This mandatory directive must correspond to a valid log type. To retrieve the list of possible log types, visit https://malachiteingestion-pa.googleapis.com/v1/logtypes?key=YOUR_API_KEY.


CustomerId

This optional directive specifies a valid unique identifier (UUID) corresponding to a particular Chronicle instance. Chronicle responds with HTTP error 400 or 403 if this ID is not valid.

ChronicleBatchSize

This optional directive specifies the recommended size (in bytes) of each batch of log data. The maximum size for unstructured logs is 1 MB (1,048,576 bytes).

HTTPSAllowExpired

This boolean directive specifies whether the connection should be allowed with an expired certificate. If set to TRUE, the connection will be allowed even if the remote server presents an expired certificate. The default is FALSE: the remote server must present a certificate that is not expired.

HTTPSAllowUntrusted

This boolean directive specifies that the connection should be allowed regardless of the certificate verification results. If set to TRUE, the connection will be allowed with any unexpired certificate provided by a server. The default value is FALSE: the remote server must present a trusted certificate.

HTTPSCADir

This directive specifies a path to a directory containing certificate authority (CA) certificates. These certificates will be used to verify the certificate presented by the remote server. The certificate files must be named using the OpenSSL hashed format, i.e. the hash of the certificate followed by .0, .1 etc. To find the hash of a certificate using OpenSSL:

$ openssl x509 -hash -noout -in ca.crt

For example if the certificate hash is e2f14e4a, then the certificate filename should be e2f14e4a.0. If there is another certificate with the same hash then it should be named e2f14e4a.1 and so on.

A remote server’s self-signed certificate (which is not signed by a CA) can also be trusted by including a copy of the certificate in this directory.

HTTPSCAFile

This specifies the path of the certificate authority (CA) certificate that will be used to verify the certificate presented by the remote server. A remote server’s self-signed certificate (which is not signed by a CA) can be trusted by specifying the remote server certificate itself. In case of certificates signed by an intermediate CA, the certificate specified must contain the complete certificate chain (certificate bundle).

HTTPSCAThumbprint

This optional directive specifies the thumbprint of the certificate authority (CA) certificate that will be used to verify the certificate presented by the remote server. The hexadecimal fingerprint string can be copied from Windows Certificate Manager (certmgr.msc). Whitespaces are automatically removed. The certificate must be imported to the certificate store accessible by NXLog user for NXLog to find it. This directive is only supported on Windows and is mutually exclusive with the HTTPSCADir and HTTPSCAFile directives.

HTTPSSearchAllCertStores

This optional boolean directive can be used to load all the possible certificates found in the Windows Certificate Store accessible by the user running NXLog. This directive is mutually exclusive with the HTTPSCAThumbprint, HTTPSCADir and HTTPSCAFile directives.

HTTPSCertFile

This specifies the path of the certificate file that will be presented to the remote server during the HTTPS handshake.

HTTPSCertKeyFile

This specifies the path of the private key file that was used to generate the certificate specified by the HTTPSCertFile directive. This is used for the HTTPS handshake.

HTTPSCertThumbprint

This optional directive specifies the thumbprint of the certificate that will be presented to the remote server during the HTTPS handshake. The hexadecimal fingerprint string can be copied from Windows Certificate Manager (certmgr.msc). Whitespaces are automatically removed. The certificate must be imported to the Local Computer\Personal certificate store in PFX format for NXLog to find it. To create a PFX file from the certificate and private key using OpenSSL:

$ openssl pkcs12 -export -out server.pfx -inkey server.key -in server.pem

This directive is only supported on Windows and is mutually exclusive with the HTTPSCertFile and HTTPSCertKeyFile directives.

HTTPSCRLDir

This directive specifies a path to a directory containing certificate revocation list (CRL) files. These CRL files will be used to check for certificates that were revoked and should no longer be accepted. The files must be named using the OpenSSL hashed format, i.e. the hash of the issuer followed by .r0, .r1 etc. To find the hash of the issuer of a CRL file using OpenSSL:

$ openssl crl -hash -noout -in crl.pem

For example if the hash is e2f14e4a, then the filename should be e2f14e4a.r0. If there is another file with the same hash then it should be named e2f14e4a.r1 and so on.

HTTPSCRLFile

This specifies the path of the certificate revocation list (CRL) which will be used to check for certificates that have been revoked and should no longer be accepted. Example to generate a CRL file using OpenSSL:

$ openssl ca -gencrl -out crl.pem
HTTPSKeyPass

This directive specifies the passphrase of the private key specified by the HTTPSCertKeyFile directive. A passphrase is required when the private key is encrypted. Example to generate a private key with Triple DES encryption using OpenSSL:

$ openssl genrsa -des3 -out server.key 2048

This directive is not needed for passwordless private keys.

HTTPSSSLCompression

This boolean directive allows you to enable data compression when sending data over the network. The compression mechanism is based on the zlib compression library. If the directive is not specified, it defaults to FALSE: compression is disabled.

Some Linux packages (for example, Debian) use the OpenSSL library provided by the OS and may not support the zlib compression mechanism. The module will emit a warning on startup if the compression support is missing. The generic deb/rpm packages are bundled with a zlib-enabled libssl library.

Examples

Example 1. Sending unstructured plain text logs

This configuration reads log messages from file and forwards them to Chronicle. No further processing is done on the log records.

nxlog.conf
define BASE_URL           https://malachiteingestion-pa.googleapis.com/
define ENDPOINT           v1/unstructuredlogentries

# Google Chronicle API key, required.
define API_KEY            DUMMY_API_KEY

<Output chronicle>
    Module                om_chronicle
    URL                   %BASE_URL%%ENDPOINT%?%API_KEY%

    # Identifies the type of logs in the batch.
    LogType               CMD

    # Batch size in bytes (B), optional.
    ChronicleBatchSize    1024

    # Customer ID, optional.
    # CustomerId          DUMMY_CUSTOMER_ID
</Output>
Input sample

For a given log record sample:

Mar 24 15:58:53 pc1 systemd[1452]: tracker-store.service: Succeeded.
Mar 24 15:58:54 pc1 systemd[1452]: tracker-store.service: Succeeded.
Mar 24 15:58:55 pc1 systemd[1452]: tracker-store.service: Succeeded.
Output sample

The following is the JSON-formatted log record that will be sent to Google Chronicle. Note that the ts_rfc3339 field is added by the module and specifies the time when the event was received (corresponds to $EventReceivedTime).

{
  "log_type": "CMD",
  "entries": [
    {
      "log_text": "Mar 24 15:58:53 pc1 systemd[1452]: tracker-store.service: Succeeded.",
      "ts_rfc3339": "2022-01-28T23:02:51.755754+02:00"
    },
    {
      "log_text": "Mar 24 15:58:54 pc1 systemd[1452]: tracker-store.service: Succeeded.",
      "ts_rfc3339": "2022-01-28T23:02:51.755823+02:00"
    },
    {
      "log_text": "Mar 24 15:58:55 pc1 systemd[1452]: tracker-store.service: Succeeded.",
      "ts_rfc3339": "2022-01-28T23:02:51.755856+02:00"
    }
  ]
}