Log monitoring and Alerting tool for log4j and python logs - monitoring

I would like to search for Error/Fatal logs in various log files(12) and to get some sort of alert(mail) in case of the event.
I have tested
ChainSaw - Only supports log4j and has no alert feature
Splunk - Free version does not have alert feature
Scribe - Roll out time will be a bit higher.
Default logging of Log4j & Python has mail alert feature but I would like to keep my configuration in one place instead of lying around in different files
My other option is to write a program that reads all the log files and searches for the regex and on matching takes the necessary action, but I would like to know if there is already a opensource tool available for that.

If the logs you want to monitor are on just one host, you can use Cron or Nagios.
If they're on multiple hosts, use Nagios.
Nagios has a pretty advanced plugin that allows you to monitor logs however you want.
(Example)
To monitor several logs in a directory:
logrobot autoblz /var/log 60m '.' 'ERROR' 1 2 log_mon -ndfoundn
To monitor a single log file:
logrobot autoblz /var/log/syslog 60m '.' 'ERROR' 1 2 syslog_monitor -ndfoundn

Related

How to catch an ouppuit of a process or a command

I'm trying to write a rule where the condition depends on the output of a script.sh. I had tried several approaches, but I did not have success.
Searching in your documentation but didn´t find anything that help me. I tried several evt or proc, but neither of them given me any info.
In fact, this is the rule with I'm trying to see how I can find a workaround:
- rule: FIM Custom rule
desc: Testing rule
condition: access_log_files and (evt.type=close)
output: Test result (proc_name=%proc.name command=%proc.cmdline evt_type=%evt.type evt.args =%evt.args syslog_.facility_str=%syslog.facility.str syslog_message=%syslog.message)
priority: WARNING
Consider please that I´m running Falco on Docker with the last image.
When I execute in the Ubuntu host the command logger test, I recievedin the stdout of the docker falco container this message:
{"hostname":"dc95654c63c3","output":"01:21:29.759239580: Warning Test result (proc_name=python3 command=python3 /usr/lib/ubuntu-advantage/timer.py evt_type=close evt.args =res=0 syslog_.facility_str= syslog_message=)","priority":"Warning","rule":"FIM Custom rule","source":"syscall","tags":[],"time":"2022-12-17T01:21:29.759239580Z", "output_fields": {"evt.args":"res=0 ","evt.time":1671240089759239580,"evt.type":"close","proc.cmdline":"python3 /usr/lib/ubuntu-advantage/timer.py","proc.name":"python3","syslog.facility.str":null,"syslog.message":null}}
So please tell me what I can do.
Thanks
In order to feed Falco with external sources of events (those that are not Kernel Syscalls) you'd need to use a Falco plugin. There are plugins to obtain events from Kubernetes, AWS CloudTrail, or even from GitHub. However, there is no plugin, that I know of, to obtain information from the standard output of a program or from Syslog.
Due to the nature of the project Falco, anyone in the community can contribute with such a plugin, so I invite you to join the Falco slack channel and ask around, or even write your own plugin.

Configuring smart monitoring tools in Zabbix Agent and Server 4

I am trying to use this to monitor hdd health:
https://share.zabbix.com/storage-devices/smartmontools/smart-monitoring-with-smartmontools-lld
I have followed the steps for the agent and server (at least that is my understanding) and would like to know how can I check the monitoring status. even though I might only get an alert in the dashboard if something goes wrong, I would like to see the current status, understand if monitoring is working and everything is ok.
I have followed the linux agent installation steps here: https://github.com/v-zhuravlev/zbx-smartctl
I have also imported the template on the zabbix frontend, and associated the template with the server being monitored.
What now? How can I check if this is working? It seems like there is something missing, but I am not sure where or how to check.
UPDATE:
I am using this template (which mentions Zabbix 3.4) even though I am using Zabbix 4. Since the template in Zabbix Share mentioned it was compatible with 3.4+, I assume this is not an issue: https://github.com/v-zhuravlev/zbx-smartctl/blob/master/Template_3.4_HDD_SMARTMONTOOLS_2_WITH_LLD.xml
Now you should go to "Latest data" and select your server as a host.
You will get the list of the discovered items where you will find the items related to the disk health.
Then, try to select an item and build with it a graph for example and put it in a dashboard.

How to display log for Rails application?

I have a rails app and I would like to display the log in the app itself. This will allow administrators to see what changes were recently made without entering the console and using the file with the logs. All logs will be displayed in the application administration. How is it possible to implement and what kind of gems do I need to use?
You don't need a Gem.
Add a controller, read the logfiles and render the output in HTML.
Probably need to limit the number of lines you read. Also there might be different log files to chose from.
I don't think this is a good idea though. Log files are for finding errors and you should not need them in your day to day work, unless you manage ther server.
Also they might contain sensitive data (CC Numbers, Pwds, ...) and it might get complicated when you use multiple servers with local disks.
Probably better to look at dedicated tools for this and handle logs outside of your application.
Assuming that you have git associated with your application or git bash installed in your system.
For displaying log information for the development mode, migrate to your application folder in your console/terminal and type tail -f log/development.log

Disable Jenkins Log File Usage

Jenkins has the cool perk of logging almost everything that happens during your build process. Right now everything is logged in /var/log/jenkins/jenkins.log.
After regular periods, this file grow to more than 400 GB in space.
Is there any way to disable this "feature"?
As the system the system is used company internally, I would'nt mind, disabling logging at all.
Thanks for your help!
Jenkins logging is highly configurable, so you can turn off logging for packages that you;re not interested in. The configuration is done at:
$JENKINS_URL/log/
documentation is at https://wiki.jenkins-ci.org/display/JENKINS/Logging

Extract information from a log file using powershell

Hi I am new to the language of powershell s i though about playing around with it. I am trying to extract information out of a log file (the file belongs to a program called event viewer). I need to use the information under Boot Duration.
Could somebody guide me a little bit?
It will be greatly appreciated
Thanks.
Logs are always the same. Not sure if you are going to monitor boot log of windows or linux or what.. but will try to answer.
If you edit your question and add info on the operating system and an example of relevant lines of boot log file I can provide you with some powershell code.
In general you should do:
Identify how to manually see boot time in log file. For example
probably it will have a starting boot time and a finished boot time.
Something similar to this.
[2012-06-08 12:00:04] starting boot
lot of log entries
[2012-06-08 12:00:34] finished boot
Once you know how to do it manually, you have to convince powershell to do it for you. You can use regular expressions to look for the pattern of dates. In my example look for lines that contains "starting boot" and then parse it to load date.
Here you have an useful link on powershell and regular expressions: http://www.regular-expressions.info/powershell.html

Resources