• pgbadger unable to detect log file format


    一直用pgbadger分析postgresql的日志,发现周末两天的日志分析出来问题。报错信息如下:

    $  /bin/pgbadger /abce/11/log/postgresql-2021-08-08_000000.csv 
    FATAL: unable to detect log file format from /abce/11/log/postgresql-2021-08-08_000000.csv, please use -f option.
        - Error at line 17284
    

    从报错信息看,是pgbadger无法检测文件格式。
    比较了一下文件的差异

    $ file postgresql-2021-08-06_000000.csv
    postgresql-2021-08-06_000000.csv: C source, UTF-8 Unicode text, with very long lines
    
    $ file  postgresql-2021-08-09_000000.csv
    postgresql-2021-08-09_000000.csv: UTF-8 Unicode text, with very long lines
    

    之前还是一直是"C source, UTF-8 Unicode text, with very long lines",不知道这两天怎么变成了" UTF-8 Unicode text, with very long lines"。这里的原因暂时还没有查明。

    根据提示,使用了-f选项。

    $ pgbadger --help
    
    Usage: pgbadger [options] logfile [...]
    
        PostgreSQL log analyzer with fully detailed reports and graphs.
    
    Arguments:
    
        logfile can be a single log file, a list of files, or a shell command
        returning a list of files. If you want to pass log content from stdin
        use - as filename. Note that input from stdin will not work with csvlog.
    
    Options:
    
    	...
        -f | --format logtype  : possible values: syslog, syslog2, stderr, jsonlog,
                                 cvs, pgbouncer, logplex, rds and redshift. Use this
                                 option when pgBadger is not able to detect the log
                                 format.
    	...
    

    虽然执行成功了,但是没有查询语句的信息。

    $ /bin/pgbadger /abce/11/log/postgresql-2021-08-09_000000.csv -f cvs
    [========================>] Parsed 58191613 bytes of 58191613 (100.00%), queries: 0, events: 0
    LOG: Ok, generating html report...
    

    根据"queries: 0, events: 0"也可以看出来有问题。

    然后,将选项"-f cvs"换成了"-f csv",再次执行,却成功了:

    $  /bin/pgbadger /abce/11/log/postgresql-2021-08-09_000000.csv -f csv
    [========================>] Parsed 28324055 bytes of 28324055 (100.00%), queries: 2328, events: 10209
    LOG: Ok, generating html report...
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12057.
    Wide character in print at /bin/pgbadger line 12312.
    Wide character in print at /bin/pgbadger line 12312.
    Wide character in print at /bin/pgbadger line 12312.
    

      

  • 相关阅读:
    九.Protobuf3特殊类型
    八.Protobuf3更新消息类型(添加新的字段)
    七.Protobuf3 嵌套类型
    六.Protobuf3引入其他.proto文件
    五.Protobuf3 枚举
    四.Protobuf3 缺省值
    VC 在调用main函数之前的操作
    Windows下的代码注入
    C 堆内存管理
    VC++ 崩溃处理以及打印调用堆栈
  • 原文地址:https://www.cnblogs.com/abclife/p/15118914.html
Copyright © 2020-2023  润新知