Python Forum
reading remote active log file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reading remote active log file?
#1
Hello ,
I want to be able to read a remote log file that run all the time
can I do this?
I have acess to the server , and can run the python app on the same server (no need for remote ssh\tcl\udp connection - if it will be easier to think of solution)
the reason is that I have only access to the file and not the code the create it (then I would just ask to send me the data , but I can't)
now I'm reading the file manually using 'tail -f logs/error.log' , and take action line by line
I want to read the entries and do something with them using python (send alerts , send files -- acoording tom my own rules)
the data is kind of simple syslog data

Thanks ,
Reply
#2
Various implementations of tail exist in Python. You can perhaps try pygtail
Reply
#3
Have a look at David Beazley’s Using Python Generator to Monitor Data. In my understanding it addresses your problem in concise and pythonic way
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#4
Thank you
I will take a look
it's seem like a good solution
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  reading and writing a image stored in a file Skaperen 4 2,169 Feb-12-2022, 04:03 AM
Last Post: Skaperen
  reading an f-string from a file Skaperen 4 4,934 Nov-03-2019, 01:59 AM
Last Post: Skaperen
  First Active Online Python Linter ethanchewy 4 102,444 Sep-19-2017, 03:58 AM
Last Post: ethanchewy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020