Sudhansu Bandha
04/04/2024, 7:09 AMreceivers:
filelog:
include: [/tmp/*.*]
start_at: beginning
processors:
attributes/nodeApplication:
actions:
- key: node_application
value: "my-node-app"
action: insert
attributes/nodeApplicationEnvironment:
actions:
- key: node_application_environment
value: "Dev"
action: insert
batch:
send_batch_size: 10000
send_batch_max_size: 11000
timeout: 10s
exporters:
otlphttp:
endpoint: <https://signals-collector-http.qualix.ai>
service:
pipelines:
logs:
receivers: [filelog]
processors:
[
attributes/nodeApplication,
attributes/nodeApplicationEnvironment,
batch,
]
exporters: [otlphttp]
docker run -d --name signoz-host-otel-collector --user root -v $(pwd)/logs:/tmp:ro -v $(pwd)/otel-collector-config.yaml:/etc/otel/config.yaml signoz/signoz-otel-collector:0.88.11
A new file is getting generated using this format YYYY-MM-DD.log on daily basis in the logs directory of the node application. And the otel collector configuration is present at root directory of the node application.nitya-signoz
04/04/2024, 8:52 AMSudhansu Bandha
04/04/2024, 8:58 AMconst bunyan = require('bunyan');
const RotatingFileStream = require('bunyan-rotating-file-stream');
const buny = bunyan.createLogger({
name: process.env.APP_NAME || 'nodelib',
level: "debug",
serializers: bunyan.stdSerializers,
streams: [{
type: 'raw',
stream: new RotatingFileStream({
path: "./logs/%Y-%m-%d.log",
period: '1d', // daily rotation
rotateExisting: true,
totalFiles: 30, // keep 30 back copies
threshold: '256m', // Rotate log files larger than 256 megabytes
totalSize: '1g', // Don't keep more than 1g of archived log files
gzip: true,
startNewFile: false,
})
}]
});
module.exports = buny;