Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging not working #28

Open
courtesysoft opened this issue Jan 27, 2023 · 9 comments
Open

Logging not working #28

courtesysoft opened this issue Jan 27, 2023 · 9 comments

Comments

@courtesysoft
Copy link

Hey, great piece of software; i'm using it to monitor systems now :)

The logging feature is not working for me in ubuntu 20.04 straight from the repo ( not sure what version i picked up )
It writes something like bootup messages and then logs nothing.
Switch over to -f and i get the messages.

Quite a bummer.. can it be fixed? until then i'll be doing loggedfs > /var/log/loggedfs.log 2>&1

@mnjdhl
Copy link

mnjdhl commented Mar 16, 2023

Hi @courtesysoft,

I can look into this if @rflament and other contributors are okay.

@mnjdhl
Copy link

mnjdhl commented Mar 22, 2023

@courtesysoft did you use " -l log-file" option start "loggedfs" ? Can you let me know the command how you launched it to reproduce the issue?

@jurijsteblaj
Copy link

Hi @mnjdhl,

I encountered the same issue I think. The command I ran was loggedfs -l log.txt /home/uporabnik/test. The logs referring to the LoggedFS program (starting, chdir, closing) did appear in log.txt, but the actual FS events appeared in /var/log/syslog.

I hope you or someone else can fix this :)

@courtesysoft
Copy link
Author

courtesysoft commented Jan 3, 2024

Damn, sorry for such a late response.

Here is the command i used to instantiate it:
loggedfs -f -p -c /home/ubuntu/loggedfs.conf /var/www/ > /var/log/loggedfs.log 2>&1

Here's loggedfs.conf ( configured to only log writes and ignore reads happening over our IDE via SSHFS ):

<?xml version="1.0" encoding="UTF-8"?>
<loggedFS logEnabled="true" printProcessName="true">
  <includes>
    <include extension=".php" uid="*" action="writeonly" retname=".*"/>
    <!-- <include extension=".php" uid="*" action="release" retname=".*"/> -->
    <include extension=".js" uid="*" action="writeonly" retname=".*"/>
    <include extension=".css" uid="*" action="writeonly" retname=".*"/>
    </includes>
</loggedFS>

In my case, -c was pointing to a file that didn't exist. My bad. I fixed this.

What i find is that i have to sudo this command for this to work. Otherwise loggedfs would just close, complaining about the user_allow_other setting in /etc/fuse.conf. After setting that, it complains about a -o nonempty fuse command, and will close itself instead of run.

With running it as sudo, the above configuration now works.

Perhaps this should be clarified in the documentation. The documentation doesn't state you have ot use sudo or be the root user. LoggedFS should have some kind of sanity check to let you know this is a requirement.

@courtesysoft
Copy link
Author

Actually i still have a problem.

Both of these commands are equivalent to start loggedfs:
sudo loggedfs -f -p -c /home/ubuntu/loggedfs.conf -l /var/log/loggedfs.log /var/www/
sudo loggedfs -f -p -c /home/ubuntu/loggedfs.conf /var/www/ > /var/log/loggedfs.log 2>&1

From the command line, these won't result in launching as a background process. The terminal will not return to bash. This is expected when using the -f in the command line.

But i want loggedFS to run as a background service. And here's my problem.

in /lib/systemd/system/loggedfs.service, i have this pointing at a shell script that contains:
sudo loggedfs -f -p -c /home/ubuntu/loggedfs.conf /var/www/ > /var/log/loggedfs.log 2>&1

[Unit]
Description=loggedfs
After=network.target

[Service]
Type=forking
ExecStart=bash /home/ubuntu/loggedfs.sh

[Install]
WantedBy=multi-user.target

When i start this service, the command line hangs and eventually terminates itself and closes loggedfs.

If i change loggedFS command line to:
sudo loggedfs -p -c /home/ubuntu/loggedfs.conf /var/www/ > /var/log/loggedfs.log 2>&1

The process successfully starts and runs in the background, but loggedFS doesn't log at all.
This happens if i use the -l syntax instead of 2>&1 as well.

I think it's possible my systemd file is not jiving with how loggedFS works with -f. Any clues?

@courtesysoft
Copy link
Author

I think i finally have it licked:

loggedfs-l.sh:
sudo loggedfs -f -p -c /home/ubuntu/loggedfs.conf -l /var/log/loggedfs.log /var/www/

loggedfs.service:

`[Unit]
Description=loggedfs
After=network.target

[Service]
Type=simple
ExecStart=bash /home/ubuntu/loggedfs-l.sh

[Install]
WantedBy=multi-user.target`

loggedfs.conf:

<?xml version="1.0" encoding="UTF-8"?> <loggedFS logEnabled="true" printProcessName="true"> <includes> <include extension=".php" uid="*" action="writeonly" retname=".*"/> <!-- <include extension=".php" uid="*" action="release" retname=".*"/> --> <include extension=".js" uid="*" action="writeonly" retname=".*"/> <include extension=".css" uid="*" action="writeonly" retname=".*"/> </includes> </loggedFS>

This has been working for more than a few minutes.

@mnjdhl
Copy link

mnjdhl commented Jan 4, 2024

@courtesysoft Good to know that it's working.

If anything I can help pl let me know

@courtesysoft
Copy link
Author

Thanks for your responses, and also building this thing!

While i have you here, do you plan for any updates to this software? i see it hasn't had an update in 6 years.
I love how it works, and actually want to build a source control system using it.. but right now we are using it to diagnose multi-user SSHFS issues.

I'm just wondering if it will get updates in the future?

@jurijsteblaj
Copy link

@mnjdhl, it seems I have a different issue than courteysoft. My example, written above, is almost exactly the same as the one in official examples, yet it doesn't work. It seems similar to this issue, actually: #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants