Giter Club home page Giter Club logo

django-logtailer's People

Contributors

cpankajr avatar dima-kov avatar fireantology avatar mauro-rocco avatar morlandi avatar sadikekin avatar tclancy avatar timsmacbook avatar viveksoundrapandi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

django-logtailer's Issues

Implement Allowed Directory List

This library can be built into application(e.g. admin portal of some webapp, that is the case I encountered).

While reading log files is a feature of app for troubleshooting purposes, it should not allow to read files from arbitrary directories.
Request log file path should be normalized and checked if it is still inside of allow directory(or list of directories).

Otherwise it can lead to security issue CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

UnicodeDecodeError raised by log view

UnicodeDecodeError at /admin/logs/get-log-line/1/ 'ascii' codec can't decode byte

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/logtailer/views.py", line 56, in get_log_lines
content = get_history(file, history)
File "/usr/local/lib/python3.8/site-packages/logtailer/views.py", line 31, in get_history
data.append(f.read(buffer_size))
File "/usr/lib64/python3.8/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]

The error makes it impossible to view log.
Please make the encoding configurable is settings or in LogFile model or most preferably in both places.

Even if correct encoding is configured, the error might still appear if log contains invalid codepoints. logtailer should be resilient to such characters - replace them with '?' or something...

Django Version: 3.0.8
Python Version: 3.8.3

A friendly recommendation with a minor Issue

Firstly I want to address that this is NOT A ISSUE, just a friendly recommendation.

I am using

  • Python 3.9.9
  • Django 3.2.7

I love what you did. Direct access to log files from the Administration saves me so much time. What I would suggest is:

  1. I noticed that the default for "Last lines to read" is 0. It would be great if you could add a functionality where the user would specify the last N number of rows he wants to see. The default could also be equal to the number of lines in the log file and than the user would just specify the first line he wants to see up to the last one.
    The problem is that most of the time you do not know how long the log file is. That is why the default should be equal to the length of the log file itself.

  2. Also, what will happen if I have a log file with 10 lines and I specify last line to read to 1000 and than I try to debug something. The debugging can produce a 1000 lines easily that is why you should think of something like tail -f <log_file> as a functionality.

I also found an actual issue. When specifying the "Last lines to read" parameter and then start reading. After I press Stop reading, I am unable to change the "Last lines to read" parameter

Other than that the package you created is awesome. Good job

on_delete-Error in models.LogsClipboard

Using django-logtailer in Django 2.2 you will get an error:

File "/opt/fmh/cookiecutter-django/fmh-editors/venv/lib/python3.7/site-packages/logtailer/models.py", line 29, in <module>
    class LogsClipboard(models.Model):
File "/opt/fmh/cookiecutter-django/fmh-editors/venv/lib/python3.7/site-packages/logtailer/models.py", line 33, in LogsClipboard
    log_file = models.ForeignKey(LogFile, verbose_name=_('log file'))
TypeError: __init__() missing 1 required positional argument: 'on_delete'

during django migrate or starting the development-server.

The fix is to add an 'on_delete=models.CASCADE' to the model:

class LogsClipboard(models.Model):
    #...
    log_file = models.ForeignKey(LogFile, verbose_name=_('log file'), on_delete=models.CASCADE)

add this package to pypi

Hey guys (or girls), this pckge is wonderful but I cannot use this in my code until it can be managed with PIP.
Please, this will help me a lot!

Develope a Plugin Base Approach

Hi!
I Like the idea and want to Develop it (if I had time) and let users have something like a plugin to get a log file from everywhere they want. for example an s3 bucket, a file in another server through ssh and so on.
do you accept any pull request?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.