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

可否兼容Win平台 #2

Closed
beiguancyc opened this issue Dec 14, 2020 · 15 comments
Closed

可否兼容Win平台 #2

beiguancyc opened this issue Dec 14, 2020 · 15 comments

Comments

@beiguancyc
Copy link

beiguancyc commented Dec 14, 2020

试用了一下,效果拔群!
不知是否可以兼容Win平台,在win平台测试时错误
执行命令python main.py -r inputer -c config.ini时
报错
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 315, in _bootstrap
self.run()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "C:\data\wLogger-master\main.py", line 13, in runReader
r = Reader(log_file_conf=log_files_conf ,config_name=config_name)
File "C:\data\wLogger-master\Src\Core.py", line 192, in init
self.server_conf = loggerParse(log_file_conf['server_type'],self.conf[log_file_conf['server_type']]['server_conf']).logger_format
File "C:\data\wLogger-master\Src\Core.py", line 28, in init
self.logger_format = self.__handler.getLoggerFormatByServerConf(server_conf_path=server_conf)
File "C:\data\wLogger-master\ParserAdapter\Nginx.py", line 404, in getLoggerFormatByServerConf
content = fd.read().decode(encoding="utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 4226: invalid start byte

@jyolo
Copy link
Owner

jyolo commented Dec 14, 2020

不好意思~ 暂不支持~ ;后面有时间的话我会优化兼容win平台

@beiguancyc
Copy link
Author

不好意思~ 暂不支持~ ;后面有时间的话我会优化兼容win平台

应该是可以兼容,我现在已经解决了上面的问题,但是卡在了

执行python main.py -r outputer -c config.ini 卡死

我觉得应该能跑起来

@jyolo
Copy link
Owner

jyolo commented Dec 14, 2020

打开outputer 里面的 log_debug 看看,如果跑起来的话 。 欢迎 提交 pr

@beiguancyc
Copy link
Author

折腾的过程中碰到很多坑,最终还是没有搞定,日志的切割也始终没有正常执行。
期待作者早日支持Windows和Mac。

@beiguancyc beiguancyc reopened this Dec 14, 2020
@jyolo
Copy link
Owner

jyolo commented Dec 14, 2020

好的~

@jyolo jyolo closed this as completed Dec 14, 2020
@beiguancyc
Copy link
Author

又折腾了一早上,目前卡在inputer的日志切割,报错如下
image
切割文件夹权限也设置成了everyone,,,,

@jyolo
Copy link
Owner

jyolo commented Dec 15, 2020 via email

@beiguancyc
Copy link
Author

日志文件里面写的很清楚了,日志切割存储目录 权限的问题,每一级的目录写的权限都检查下吧。执行命令前带上sudo,

---原始邮件--- 发件人: "beiguancyc"<notifications@github.com> 发送时间: 2020年12月15日(周二) 上午9:40 收件人: "jyolo/wLogger"<wLogger@noreply.github.com>; 抄送: "State change"<state_change@noreply.github.com>;"jyolo"<438608613@qq.com>; 主题: Re: [jyolo/wLogger] 可否兼容Win平台 (#2) 又折腾了一早上,目前卡在inputer的日志切割,报错如下 切割文件夹权限也设置成了everyone,,,, — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

我让inputer自己创建切割文件夹。
文件夹可以创建成功,但是最终还是和上面一样的报错。
是不是Windows平台有特殊要求?

@jyolo
Copy link
Owner

jyolo commented Dec 15, 2020 via email

@jyolo
Copy link
Owner

jyolo commented Dec 15, 2020 via email

@beiguancyc
Copy link
Author

beiguancyc commented Dec 16, 2020

不好意思还得再麻烦您一下,我在Windows上的问题基本已经排除的差不多,但是功能上又碰到了一个问题。
我的NGINX的日志格式为默认格式:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

config.ini设置
log_format_name = main

read_type = tail

但是依然报错
解析日志失败,请检查client 配置中 日志的 格式名称是否一致 log_format_name

以下是错误信息

{"node_id": "server_80", "app_name": "web1", "log_format_name": "main", "line": "223.198.177.192 - - [15/Dec/2020:15:30:37 +0800] "POST /j/classes/Check HTTP/1.1" 200 46433 "https://www.xxx.cn:4040/\" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-"", "log_format_str": "$remote_addr - $remote_user [$time_local] "$request" '\r\n '$status $body_bytes_sent "$http_referer" '\r\n '"$http_user_agent" "$http_x_forwarded_for"", "log_format_vars": "$remote_addr<@>$remote_user<@>$time_local<@>$request<@>$status<@>$body_bytes_sent<@>$http_referer<@>$http_user_agent<@>$http_x_forwarded_for"}

@jyolo
Copy link
Owner

jyolo commented Dec 16, 2020 via email

@beiguancyc
Copy link
Author

目前我已经在Windows上跑通,第一次写python,碰到了太多问题,跟大家分享下经验

1.保证nginx的配置文件和日志文件都是用utf-8
2.日志移动到目标目录的时候,注意文件命名斜杠和反斜杠的问题
3.日至移动的当前代码无法在Win平台使用,另外我的nginx安装成服务,如何移动日志还需要测试
4.日志解析时生成的正则表达式和日志无法匹配。查资料后可能是因为Windows和linux 的差异性问题

目前1,2都已经解决。
3 需要考虑nginx占用日志的情况并需要测试
4 还需要做大量测试

感谢作者提供了这么好的日志分析系统

@jyolo
Copy link
Owner

jyolo commented Dec 17, 2020 via email

@beiguancyc
Copy link
Author

客气了,喜欢就好,那帮忙在v2ex 发个贴 分享一下,让更多的的人看到。希望该项目能帮助到更多的人。谢谢了~

------------------ 原始邮件 ------------------ 发件人: "jyolo/wLogger" <notifications@github.com>; 发送时间: 2020年12月17日(星期四) 中午12:53 收件人: "jyolo/wLogger"<wLogger@noreply.github.com>; 抄送: "未命名的旋律"<438608613@qq.com>;"State change"<state_change@noreply.github.com>; 主题: Re: [jyolo/wLogger] 可否兼容Win平台 (#2) 目前我已经在Windows上跑通,第一次写python,碰到了太多问题,跟大家分享下经验 1.保证nginx的配置文件和日志文件都是用utf-8 2.日志移动到目标目录的时候,注意文件命名斜杠和反斜杠的问题 3.日至移动的当前代码无法在Win平台使用,另外我的nginx安装成服务,如何移动日志还需要测试 4.日志解析时生成的正则表达式和日志无法匹配。查资料后可能是因为Windows和linux 的差异性问题 目前1,2都已经解决。 3 需要考虑nginx占用日志的情况并需要测试 4 还需要做大量测试 感谢作者提供了这么好的日志分析系统 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

等我完成测试后一定会的

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

2 participants