Log Filesystem

Receiver no-reply

This service implements a filesystem logger. The logs will be written directly to a file on the filesystem with log rotation and age control.

docker pull registry.goingrid.io/services/log-filesystem:v0.1.0

Table of contents

Service properties

This service implements the ingrid protocol message. Following properties are being used:

Property Usage
Class -
Operation -
Control -
Data See below

Data

The log stdout service accepts following payload data properties:

Key Multivalue default Note
severity no info Valid values:
info warn error debug trace Data will be logged always
actor no no
message no no

Service capabilities

Log message

POST https://rest.app.goingrid.io/log/slap HTTP/1.1
content-type: application/json
Ingrid-Mode: Execution
Authorization: Basic admin nutz

{
    "severity": ["info"],
    "actor" : ["rest"],
    "message": ["This is an example info message"]
}
[[ $req := newRequest ]]
[[ $data := setValue newData "severity" "info" ]]
[[ $data = setValue $data "actor" "log-filesystem" ]]
[[ $data = setValue $data "message" "This is an example info message" ]]

[[ $req = setRequestData $req $data ]]

[[ $resMsg := ingridExec "log_slap" $req ]]
log-filesystem:
  image: registry.goingrid.io/services/log-filesystem:v0.1.0
  deploy:
    restart_policy:
      condition: on-failure
    placement:
      constraints:
        - node.role == manager
  environment:
    NAME: "log-filesystem"
    SERVERHOST: "hive"
    SERVERAUTH: "file:///run/secrets/ing-hive-key"
    INPUTCHANNEL: "log_slap"
  volumes:
    - "log-filesystem:/logs"
  depends_on:
    - hive
  secrets:
    - ing-hive-key
  networks:
    - ing-entry
    - ing-middle


volumes:
  log-filesystem:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: log-filesystem
spec:
  selector:
    matchLabels:
      app: log-filesystem
  template:
    metadata:
      labels:
        app: log-filesystem
    spec:
      containers:
      - name: log-filesystem
        env:
        - name: name
          value: log-filesystem
        - name: SERVERHOST
          value: ingrid-hive
        - name: LOGLEVEL
          value: debug
        - name: LOGFORMAT
          value: TEXT/DEFAULT
        - name: LOGSENSITIVE
          value: "false"
        - name: INPUTCHANNEL
          value: log_slap
        - name: LOGFILE
          value: /logs/ingridTest.log
        - name: SERVERAUTH
          valueFrom:
            secretKeyRef:
              key: serverkey
              name: ingrid-serverkey
        image: registry-dev.goingrid.io/services/log-filesystem:latest
        imagePullPolicy: Always
        resources:
          limits:
            cpu: 200m
            memory: 32Mi
          requests:
            cpu: 50m
            memory: 16Mi
        volumeMounts:
        - mountPath: /logs
          name: log-filesystem
      serviceAccount: ingrid
      serviceAccountName: ingrid
      volumes:
      - name: log-filesystem
        persistentVolumeClaim:
          claimName: log-filesystem-claim

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: log-filesystem-claim
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Mi
  storageClassName: nfs

Service configuration

Parameter Default Description
InputChannel* "log_slap" Channel to be used as input
LogFile logs/ingrid.log Path to the log file (".%Y%m%d%H%M" will be added automatically at the end), creates path if not exists
MaxAge 168h Time to wait until old logs are purged
RotationTime 24h Interval between log rotation

* inherited from service configuration, mentioned here because it has a different default value

Additionally the log filesystem service includes all properties of the service configuration and the input configuration.

Limitations