-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from sematext/logagent_updates_2
Add Logagent plugins
- Loading branch information
Showing
10 changed files
with
246 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
title: Parsing cri-o log format, add Kubernetes context to container logs | ||
description: Logagent features modular logging architecture framework where each input or output module is implemented as a plugin, and loaded on demand as declared in the configuration file. Input filters process raw input from input plugins before log events get parsed | ||
|
||
## Input Filter: Kubernetes cri-o / containerd | ||
|
||
Parsing cri-o containerd log format. Use the file input plugin to read log files. | ||
|
||
## Configuration | ||
|
||
Note: The plugin can be enabled via command line option `--k8sContainerd`. | ||
|
||
Add the following section to the Logagent configuration file: | ||
|
||
``` | ||
inputFilter: | ||
# parse containerd log format, add pod info to log context | ||
- module: input-filter-k8s-containerd | ||
``` | ||
|
||
The following example collects container log files, parses cri-o format, parses container logs with default log patterns, and adds Kubernetes meta-data via Kubernetes API before it ships logs to Sematext Cloud: | ||
|
||
```yaml | ||
input: | ||
# make sure files include your cri-o log container folder | ||
files: | ||
- '/var/log/containers/*.log' | ||
|
||
inputFilter: | ||
# parse containerd log format, add pod info to log context | ||
- module: input-filter-k8s-containerd | ||
|
||
outputFilter: | ||
# add k8s metadata via k8s API | ||
- module: k8s-enrichment | ||
|
||
output: | ||
elasticsearch: | ||
module: elasticsearch | ||
url: https://logsene-receiver.sematext.com | ||
index: YOUR_LOGS_TOKEN | ||
|
||
``` | ||
|
||
|
||
Run Logagent: | ||
``` | ||
logagent --config crio.yml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
title: Logagent input plugin for Kubernetes Audit logs | ||
description: Logagent features modular logging architecture framework where each input or output module is implemented as a plugin. Logagent can receive Kubernetes Audit logs via http. | ||
|
||
## Input Plugin: Kubernetes Audit Logs | ||
|
||
Input plugin to receive Kubernetes Audit logs via HTTP. | ||
|
||
Features: | ||
|
||
- parse bulk messages | ||
|
||
Applications: | ||
|
||
- centralize Kubernetes Audit logs | ||
- act as webhook to receive Kubernetes Audit logs | ||
- index Kubernetes Audit logs in Elasticsearch or Sematext Cloud | ||
- create alerts on Kubernetes Audit logs | ||
|
||
|
||
Requirements: | ||
|
||
- configure Kubernetes to send Audit logs via webhook | ||
|
||
### Configuration | ||
|
||
```yaml | ||
|
||
# Receive Kubernetes Audit logs via HTTP server | ||
input: | ||
kubernetesAudit: | ||
module: input-kubernetes-audit | ||
# server listens to a port | ||
port: 9091 | ||
# dynamic index setting by posting Audit logs to /indexName/ URL | ||
useIndexFromUrlPath: true | ||
# number of extra processes to fork as web server workers | ||
worker: 0 | ||
tags: | ||
receiver: logagent_kubernetes_audit | ||
|
||
output: | ||
# view events on console during test setups | ||
stdout: yaml | ||
# ship Audit logs to Sematext Cloud | ||
elasticsearch: | ||
module: elasticsearch | ||
url: https://logsene-receiver.sematext.com | ||
index: YOUR_LOGS_TOKEN | ||
|
||
``` | ||
|
||
Start Logagent | ||
|
||
``` | ||
logagent --config kubernetes-audit.yml | ||
``` | ||
|
||
|
||
Note: You can use the command line argument `--k8sAudit portNumber` to activate the plugin via the `logagent` command. The following command listens on TCP port 9091 for Kubernetes logs and dumps the logs in YAML format to the console. | ||
|
||
``` | ||
logagent --k8sAudit 9091 --yaml | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
title: Logagent input plugin for Kubernetes Events | ||
description: Logagent features modular logging architecture framework where each input or output module is implemented as a plugin. Logagent collects Kubernetes event logs. | ||
|
||
## Input Plugin: Kubernetes Event Collection | ||
|
||
Input plugin to collect Kubernetes events via API. | ||
|
||
Features: | ||
|
||
- parse bulk messages | ||
|
||
Applications: | ||
|
||
- centralize Kubernetes events | ||
- index Kubernetes events in Elasticsearch or Sematext Cloud | ||
- create alerts on Kubernetes events | ||
- create analytics and monitor event logs | ||
|
||
Requirements: | ||
|
||
- A working `kubectl` config | ||
- Or run Loagent in a pod, role bindings to access k8s API pods, events, and namespaces | ||
|
||
### Configuration | ||
|
||
```yaml | ||
|
||
# Receive Kubernetes events via HTTP server | ||
input: | ||
kubernetesEvents: | ||
module: input-kubernetes-events | ||
|
||
output: | ||
# view events on console during test setups | ||
stdout: yaml | ||
# ship events to Sematext Cloud | ||
elasticsearch: | ||
module: elasticsearch | ||
url: https://logsene-receiver.sematext.com | ||
index: YOUR_LOGS_TOKEN | ||
|
||
|
||
``` | ||
|
||
Start Logagent | ||
|
||
``` | ||
logagent --config kubernetes-events.yml | ||
``` | ||
|
||
|
||
Note, you can use the command line argument `--k8sEvents` to activate the plugin via logagent command. The following command would listen to Kubernetes events on TCP port 9091 and dumps the events in YAML format to console. | ||
|
||
``` | ||
logagent --k8sEvents --yaml | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
title: Ship logs via HTTP or HTTPS | ||
description: Sends log messages as HTTP or HTTPS post request | ||
|
||
## Output Plugin: HTTP | ||
|
||
Post logs to web services via `HTTP` or `HTTPS`. | ||
|
||
Supported formats: | ||
- ldjson - line delimited json | ||
|
||
### Configuration | ||
|
||
``` | ||
output: | ||
module: output-http | ||
url: http://localhost:8080/events | ||
format: ldjson | ||
# maximum number of events per request | ||
# 1 - each event creates a separate http request | ||
# >1 - multiple events in each http request | ||
maxBufferSize: 1 | ||
# flush interval in seconds | ||
flushInterval: 5 | ||
filter: | ||
field: logSource | ||
match: sensor.* | ||
``` | ||
|
||
Start Logagent | ||
|
||
``` | ||
logagent --config http.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters