Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add doc how to send logs to syslog server in vector #1986

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions doc/source/admin/monitoring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,57 @@ Prometheus as the data source. You can find more examples of how to do
this in the Grafana Helm chart `Import Dashboards <https://github.com/grafana/helm-charts/tree/main/charts/grafana#import-dashboards>`_
documentation.

Send logs to syslog server
==========================

It is possilbe to send logs to a syslog server which has the reception
enabled via socket. You will need to simply set the following inventory
variables for vector.

.. code-block:: yaml

vector_helm_values:
customConfig:
transforms:
syslog_logs:
type: remap
inputs: ["kubernetes_logs"]
# let's make RFC 5424 compatible messages for rsyslog
# read more about the format:
# https://blog.datalust.co/seq-input-syslog/#rfc5424
source: |-
pri = 1 * 8 + to_syslog_severity(.severity) ?? 6

., err = join([
"<" + to_string(pri) + ">" + "1", # <pri>version
to_string!(.@timestamp),
to_string!(.kubernetes.pod_name || .hostname || "${VECTOR_SELF_NODE_NAME}"),
to_string!(.app || .kubernetes.labels.app || "-"),
"-", # procid
to_string!(.messageid || "-"), # msgid
"-", # structured-data
decode_base16!("EFBBBF") + to_string!(.message || encode_json(.)) # msg
], separator: " ")

if err != null {
log("Unable to construct syslog message for event:" + err + ". Dropping invalid event: " + encode_json(.), level: "error", rate_limit_secs: 10)
}
sinks:
rsyslog_general:
type: "socket"
inputs: [syslog_logs]
# rsyslog server address
address: "38.108.68.134:514"
# tcp or udp
mode: "tcp"
encoding:
codec: "text"
framing:
method: "newline_delimited"

This configures a vector transformer converting log messages to rsyslog
format and sends logs to the specified rsyslog server.

************
Viewing data
************
Expand Down