jhuckaby / logalert

Monitor logs (or any text files) and send alerts on specific changes.
Other
23 stars 9 forks source link

does not work on Ubuntu 20.04? #2

Open wakjoko opened 2 years ago

wakjoko commented 2 years ago

hi, thanks for a great tool. appreciate your effort of making this tool but seems does not work in ubuntu or did i miss anything?

here's my config

{
    "monitors": [
        {
            "name": "Test Monitor",
            "path": "~/logs-to-watch/*.log",
            "match": "ALERT|WARNING|ERROR",
            "email": "me@gmail.com",
                        "mode": "whole",
                        "checksum": true
        }
    ],
    "mail_settings": {
        "host": "smtp.gmail.com",
        "port": 587,
        "secure": false,
        "auth": {
            "user": "me@gmail.com",
            "pass": "****"
        },
        "from": "me@gmail.com"
    },
    "sleep": 5,
    "echo": 1,
    "verbose": 2
}
jhuckaby commented 2 years ago

Please explain what "does not work" means. Are you seeing an error? Does the binary not launch? What is the output on the Terminal?

It's possible that LogAlert cannot interpret what the ~ symbol means in your path here:

    "path": "~/logs-to-watch/*.log",

I'm no Linux expert, but I seem to recall that that symbol (~) only works inside of a shell / terminal. That is a shell metacharacter, which is "expanded" to the current user's home directory when the path is evaluated. But LogAlert doesn't use a shell, and has no idea how to expand that character. Can you try changing this to use the full path to the file(s) you want to monitor?

wakjoko commented 2 years ago

Hey, sorry if i offended you.

the ~ is an alias for /home/user.

Binary did run and i can see the output in terminal after executing ./logalert.bin

[2021-11-19 09:17:41][LogAlert][LogAlert/1.0.0 starting up][]
[2021-11-19 09:17:41][Test Monitor][Performing initial scan: /home/user/logs-to-watch/*.log][]

then i open up other terminal to edit a file in the logs-to-watch directory and save the file with edited content.

i'm expecting to get an email right after manually editing a file but no email received even in spam, i don't see new email.

and i don't see any update in my other terminal that's running the logalert.bin

so did i made myself clear of what "does not work" means?

i have a feeling that i may missed something but i can't figure it out

jhuckaby commented 2 years ago

You didn't offend me at all. I am not sure why LogAlert isn't working for you, however. That is really strange.

Can you get it to work on a different directory? Something like /tmp/? I'm just wondering if it has something to do with the particular directory you are using, i.e. permissions or other.

wakjoko commented 2 years ago

You might be right, I'm running the binary without sudo and execute it within a user with just ./logalert.bin I'll look into that and thanks for your time anyway.