Log4j - specify a script to be executed post Log File Rollover - log4j

Can log4j be configured to run a script after RollingFile has finished to enable me to send out email that roll over has occurred or grep through log to see if a text pattern occurred, etc?
thank you

Related

Parsing Jenkins build log application log using logstash Grok pattern and load in Elasticsearch

I am very new to Logstash and ELK in general. I need to write a grok pattern for a Jenkins build console log. My requirement is below-
"Started by user User_SMS" => From this line, I have to extract the username "User_SMS" where the line starts with text "Started by user".
Similarly, from the line "git checkout -f 07999b25163b658686558d9a1d05dd99c30c6059 # timeout=10" I have to extract the hexadecimal checkout id 07999b25163b658686558d9a1d05dd99c30c6059 when line starts with "git checkout -f".
From the line I have to find the build status "Finished: SUCCESS". The line starts with "Finished:" and I have to capture the value "SUCCESS" here, it would be "FAILURE" in some other build as well.
Please help in parsing the log using Grok.
The index in Elasticsearch will have the above fields user_name, checkout_id, build_status etc.
I am unable to create the Grok pattern to parse this Jenkins log. Please guide me with this.
Jenkins Log image

pm2 logging pm2.log to JSON

I searched but didn't find it, is it possible to change pm2 logs (specifically pm2.log file, not apps logs) to log in JSON format?
Yes, with apps logs its possible via ecosystem file, but about pm2 itself?
No, But you can log pm2 start into a .log format file
pm2 start server.js --output="/path/to/file.log" --error="/path/to/file.log"
# or
pm2 start server.js --log="/path/to/file.log"
Be aware that writing output and error logs to the same file may increase your effort to search for error entries within the log file.
More detailed information about pm2 log
More detailed information about pm2 log [official site]
example convert .log file to json

how can i fix crond[296824]: No configuration file found at /root/.esmtprc or /etc/esmtprc?

I use aws crontab to run my task.
it ran smoothly for some days, but today, i found crontab failed, when i open /var/log/cron
it failed to print new message, and i found
crond[296824]: No configuration file found at /root/.esmtprc or
/etc/esmtprc
in /var/log/messages, and all mail log is empty.
My Os is Centos8, can anyone offer some suggestions? Thanks a lot
Today I had the same problem. Cron send mail notifications about errors, so it take destination info from "~/.esmtprc". If you haven't configured propertly this file, you could get that error in cron log:
crond[296824]: No configuration file found at /root/.esmtprc or /etc/esmtprc
All mails whit errors that cron couldn't sent are locate in "~/.esmtp_queue/".

How to change Flink's log directory

I understand Flink uses log4j to manage log. So I change log setting in log4j.property, where I set the output location. However, when I start job master, it says that the log location is changed, not the default location. So how could I change the log location of Flink gracefully?
The default lib directory is set via bin/config.sh. Look for FLINK_LOG_DIR. You can just update the script to change the default log directory.
Add the following line in flink-conf.yaml that can be found in conf directory of Flink installation:
env.log.dir: /var/log/flink
Where /var/log/flink is the directory you want to use for logs.
Note that Flink does not seem to support full YML syntax, so
env:
log:
dir: /var/log/flink
will not work!
Since 1.0.3 you can set env.log.dir to change the directory where the logs are saved.

any body provide me node.js gc log file

Can any body tell me how to redirect output trace_gc to log file in node js instead of console I gave command like this
node -trace_gc -trace_gc_verbose example.js
and also give me one example gc log file for node.js
If you do not need to separate the output of the application itself from the gc trace you can simply redirect the output using:
node -trace_gc -trace_gc_verbose example.js > output.log
Otherwise V8 has a --log_gc option which output to the log file (can be defined with --logfile but this does not seems to output has many information as -trace_gc.
See node --v8-options for all options

Resources