-
Notifications
You must be signed in to change notification settings - Fork 2
5 Bobbin.yml examples
Anton Pryamostanov edited this page Aug 15, 2020
·
3 revisions
Table of contents generated with markdown-toc
Examples of Bobbin.yml
for different use cases.
destinations:
- name: io.infinite.bobbin.config.ConsoleDestinationConfig
levels: [warn, error, info]
- name: io.infinite.bobbin.config.FileDestinationConfig
packages: [io.infinite]
fileName: ("./LOGS/INFINITE/${className}/${level}/${className}_${level}_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
fileName: ("./LOGS/PACKAGES/${className}/${level}/${className}_${level}_${date}.log")
format: dateTime + '|' + level + '|' + threadName + '|' + className + '|' + message
Logging Spring Boot HTTP with Bobbin
destinations:
- name: io.infinite.bobbin.config.ConsoleDestinationConfig
formatThrowable: "%format% + delimiter + throwable"
levels: [warn, error, info]
- name: io.infinite.bobbin.config.FileDestinationConfig
levels: [warn]
fileName: ("./LOGS/WARNINGS_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
levels: [error]
fileName: ("./LOGS/ERRORS_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
packages: [org.springframework.web]
fileName: ("./LOGS/SPRING_WEB/SPRING_WEB_${date}.log")
Pass named parameters to Logstash
without using MDC
(using positioned logging arguments indexes instead).
levels: [info, warn, error, debug]
destinations:
- name: io.infinite.bobbin.config.ConsoleDestinationConfig
packages: [com.acme.logstash]
dateTimeFormat: "yyyy-MM-dd'T'HH:mm:ss:SSSZ"
lineBreak: ",\r\n"
formatArgs: |-
"""{
"@timestamp": "$dateTime",
"@version": "1",
"message": "$message",
"logger_name": "$className",
"thread_name": "$threadName",
"level": "$level",
"username": "${args[0]}",
"URI": "${args[1]}",
"sessionId": "${args[2]}",
"transactionId": "${args[3]}",
"instanceId": "${MDC.get('instanceUUID')}"
}"""
Use MDC
and change formatting of individual logging signatures - like formatThrowable
in this case.
%format%
placeholder helps to reuse the base formatting (which itself can be also overridden using format
parameter).
format: dateTime + delimiter + MDC.get("instanceUUID") + delimiter + level + delimiter + threadName + delimiter + className + delimiter + message
destinations:
- name: io.infinite.bobbin.config.ConsoleDestinationConfig
formatThrowable: "%format% + delimiter + throwable"
levels: [warn, error, info]
- name: io.infinite.bobbin.config.FileDestinationConfig
levels: [warn]
fileName: ("./LOGS/WARNINGS_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
levels: [error]
fileName: ("./LOGS/ERRORS_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
packages: [org.springframework.web]
fileName: ("./LOGS/SPRING_WEB/SPRING_WEB_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
packages: [io.infinite]
fileName: ("./LOGS/THREADS/${threadGroupName}/${threadName}/${threadName}_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
packages: [conf.plugins.output]
fileName: ("./LOGS/PLUGINS/OUTPUT/${className}/${className}_${date}.log")
- name: io.infinite.bobbin.config.FileDestinationConfig
packages: [conf.plugins.input]
fileName: ("./LOGS/PLUGINS/INPUT/${className}/${className}_${date}.log")