{"id":28388237,"url":"https://github.com/opn48/pylogmanage","last_synced_at":"2025-08-20T04:22:13.418Z","repository":{"id":188638494,"uuid":"241034427","full_name":"OPN48/pyLogmanage","owner":"OPN48","description":"一个python3日志切割分片、压缩、监听发送到钉钉通知的开源项目，解决很多教程忽略reopen操作导致日志分割压缩后需要重启服务后才能写入问题，支持Nginx、uwsig日志分析，报文头自动添加服务器外网IP便于识别，不用每一台服务器都设置别名。压缩后新增的日志tar大小通知，日志文件过期自动删除，单日志文件过大提醒，一秒内同IP多次请求通知（防CC攻击）等功能","archived":false,"fork":false,"pushed_at":"2022-02-15T08:22:26.000Z","size":38,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-31T04:03:17.794Z","etag":null,"topics":["dingtalk","log","logratate","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OPN48.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-02-17T06:21:13.000Z","updated_at":"2024-08-28T07:42:15.000Z","dependencies_parsed_at":"2023-08-16T08:46:35.629Z","dependency_job_id":null,"html_url":"https://github.com/OPN48/pyLogmanage","commit_stats":null,"previous_names":["opn48/pylogmanage"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OPN48/pyLogmanage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OPN48%2FpyLogmanage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OPN48%2FpyLogmanage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OPN48%2FpyLogmanage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OPN48%2FpyLogmanage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OPN48","download_url":"https://codeload.github.com/OPN48/pyLogmanage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OPN48%2FpyLogmanage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262198128,"owners_count":23273799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dingtalk","log","logratate","python3"],"created_at":"2025-05-30T20:38:17.196Z","updated_at":"2025-08-20T04:22:13.411Z","avatar_url":"https://github.com/OPN48.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyLogmanage\nA python lite log manage open repository, rotate your log files and send the msg to your dingtalk.\n\n1.how to install:\n\nyou can use the git command clone this repository in to your logs path:\n```\ncd {your log path}\n\ngit clone --recursive https://github.com/OPN48/pyLogmanage.git \u0026\u0026 mv ./pyLogmanage/* ./ \u0026\u0026 mv ./pyLogmanage/.git ./.git \u0026\u0026 mv ./pyLogmanage/.gitignore ./.gitignore \u0026\u0026 rm -rf ./pyLogmanage\n```\nIf you don't want clone in your logs path, and than you would be change the logFilePath and the logFileList values in  ./logTools/config.py\n```buildoutcfg\nlogFilePath = os.getcwd()\nlogFileList = list(filter(None, [f if os.path.splitext(f)[1] == fileType else '' for f in os.listdir(logFilePath)]))\n```\n\n2.setting pyLogmanage:\n\n```\n$ python3 setup.py \n用法: python3 setup.py [-options] [args...](执行初始化配置)\n    -url -durl    \t配置钉钉机器人url 默认:https://oapi.dingtalk.com/\n    -d -dingtalk    \t钉钉通知开关 默认:TRUE\n    -k -dkeyword    \t配置钉钉自定义关键词 默认:logdatatar\n    -w -warnsize    \t配置单日志文件大小告警值，单位MB 默认:500\n    -day -days    \t日志删除天数 默认:180\n    -n -nginx    \t使用nginx配置的服务器可使用 默认:TRUE\n    -u -uwsgi    \t使用uwsgi配置 需要在uwsgi.ini内配置master=true和touch-logreopen=/{log文件夹}/touchforlog 默认:TRUE\n    -f -file    \t日志文件后缀名 默认:.log\n    -l -lastlines    \t读取日志文件最后n行提供listener.py判断 默认:1000\n    -m -secondmax    \t1秒钟同时请求大于m条，告警，同时作为报文倍数分组step使用 默认:3\n    -o -withoutlog    \t配置忽略log文件名使用,分割，demo:c1.log,c2.log' 默认：''\n\n```\nsetting you dingtalk url:\n```\n$ python3 setup.py -url https://oapi.dingtalk.com/robo...\n```\n\n3.compress logs file\n\n   move the project file to your logs path, and adding a cronjob to run logdatatar.py\n```\ncd {your logs path} \u0026\u0026 python3 logdatatar.py\n```\nlike:\n```\ncd /home/log \u0026\u0026 python3 logdatatar.py\n```\n**uWSGI setting:**\n\nopen your uWSGI settings file uwsgi.ini , and add this:\n```\n[uwsgi]\nmaster = true\ntouch-logreopen = {your logs path}/touchforlog\n```\nYou will receive a msg on you dingtalk group, like this:\n```\n【xxx.xxx.xxx.xx】：\nxxx_nginx_access.log 173.66MB\nxxx_uwsgi.log 1.33MB\nlog-2020-01-01.tar.gz 50.33MB\n```\n4.listener logs\nadding a cronjob to run listener.py\n```\ncd {your logs path} \u0026\u0026 python3 listener.py\n```\nlike:\n```\ncd /home/log \u0026\u0026 python3 listener.py\n```\nYou will receive a msg on you dingtalk group, like this:\n```\n【xxx.xxx.xxx.xx】The Last 1000 lines log:\n【more than 3/s】:\nxxx//api/get/?\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopn48%2Fpylogmanage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopn48%2Fpylogmanage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopn48%2Fpylogmanage/lists"}