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

Clear logs? #469

Closed
gardiol opened this issue Apr 8, 2020 · 18 comments
Closed

Clear logs? #469

gardiol opened this issue Apr 8, 2020 · 18 comments
Labels
Documentation Missing documents and help Not an Issue/Wont fix This is not an issue

Comments

@gardiol
Copy link
Contributor

gardiol commented Apr 8, 2020

My lychee installation has a huge logs table in the database... I mean over 115mb when exported. Is possible to have a way to limit log size or purge/clear from UI?

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

php artisan lychee:logs clean

This will clear the log database.

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

from the UI there should be a button to remove the Notice and Warnings

@ildyria ildyria added the Not an Issue/Wont fix This is not an issue label Apr 8, 2020
@gardiol
Copy link
Contributor Author

gardiol commented Apr 8, 2020

There is... but my table grow so big that the web page timed out before any log was shown... and the button did not work i guess for the same reason. At that point, i cleared the table from phpmyadmin,... Good to know the artisan command.. Still would be useful to prevent this situation. Also, logging on database seems... odd. Is there a reason a normal file is not used? For example i cannot parse the database with logcheck.

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

Well the initial Lychee was logging on Database, we did not change that. Also it is easier to retrieve and manage than files...

Laravel do logs their error in files but the problem is that it is then quite hard to read and it is more dev oriented...

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

There is... but my table grow so big that the web page timed out before any log was shown... and the button did not work i guess for the same reason.

There is also another way but not advertised. 😇 (Sorry)

If you are logged in as admin and you go to https://example.com/api/Logs::clear (GET request) it will do the same as php lychee:logs clean

@gardiol
Copy link
Contributor Author

gardiol commented Apr 8, 2020

Yes but a growing log in a database can be a problem.
Also, cannot be analyzed with standard server log check tools.

I do backups, of course who don't, of my server, and 116mb of log was a bit strange, indeed the Lychee mysql backup was even bigger than my NextCloud instance backup, weird.

Maybe it was so big because i have debug enabled?

Indeed not a major issue at all, but my guess something should be considered.

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

That is really surprising... My log database is 4 Mio (14 400 lines) and I have 12 155 lines in my Photo table.

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

You should have a look what are the warnings in it. I find this pretty strange.

@gardiol
Copy link
Contributor Author

gardiol commented Apr 8, 2020

i had over 250K lines... My guess is most where due to the various "upgrades" i did from Lychee 3 to Lychee 4 and then to git build... then i forgot composer install and artisan migrate.. All things considered...
Also i loaded hundreds of thousands of pictures in this convoluted timeframe...

I am sorry i deleted the rows before actually saving them.. I could fetch yesterday backup and check if you think it's important

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

Also, you can just do compose install --no-dev :)

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

Nah it should be fine, you can just upload new pictures, if something is wrong you will see warnings poping up again. :)

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

Did the upgrade from v3 to v4 went smoothly ?

@ildyria ildyria added the Documentation Missing documents and help label Apr 8, 2020
@gardiol
Copy link
Contributor Author

gardiol commented Apr 8, 2020

I now have this little upgrade script:

#!/bin/bash
git pull
php composer.phar install --no-dev
php artisan migrate

Might be interesting for other users.
The upgrade went well.. i did it more or less two months ago. Absolutely painless and no issues...

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

I would add a chown -R www-data:www-data * in it just to make sure that the ownership are correct if your web user is www-data (at least that the case for apache). :)

Happy to hear that the upgrade went painlessly. 🎉

@gardiol
Copy link
Contributor Author

gardiol commented Apr 8, 2020

I prefer not to, for security reasons... I have my "storage" and "public/upload" folders assigned to group "apache" with g+w permissions... So far it seems to be enough... is it?

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

oh sure. :) that was if you wanted to make the update directly from the GUI. :)

@gardiol
Copy link
Contributor Author

gardiol commented Apr 8, 2020

Is it possible to do the update directly from the GUI? How?
Lychee is a marvel.. I just discovered the artisan lychee:sync command and i am loving it...

@ildyria
Copy link
Member

ildyria commented Apr 8, 2020

Is it possible to do the update directly from the GUI? How?

You go to Diagnostics -> Check for Updates
Once done you need to update the Diagnostic page (click on it again in the left menu)
You will see a Apply Update button on the top. Click on it and done. 😛

If it breaks (error 500) you can still go back to command line and do your git pull, migrate etc...

There are some securities that you need to disable via the advanced settings menu:

  • you need to allow update is your .env specify production:
    force_migration_in_production = 1
  • you need to allow composer :
    apply_composer_update = 1 (optional)

The second one is really optional if updates don't need the composer (like 90% of the time) then it can just stay at 0. :)

Hidden tip: to quickly make the login dialog show, you can just press L instead of having to click on the Login button. 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Missing documents and help Not an Issue/Wont fix This is not an issue
Projects
None yet
Development

No branches or pull requests

2 participants