kellyjonbrazil/jc

New parser: php-fpm8.2 -tt

Open

#546 建立於 2024年2月25日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)Python (175 fork)batch import
good first issuenew-parser

倉庫指標

Star
 (7,173 star)
PR 合併指標
 (平均合併 3天 6小時) (30 天內合併 3 個 PR)

描述

The PHP-FPM configuration for a specific version of PHP is returned as standard error with:

/usr/sbin/php-fpm8.2 -tt
[25-Feb-2024 20:25:25] NOTICE: [global]
[25-Feb-2024 20:25:25] NOTICE:  pid = /run/php/php8.2-fpm.pid
[25-Feb-2024 20:25:25] NOTICE:  error_log = /var/log/php8.2-fpm.log
[25-Feb-2024 20:25:25] NOTICE:  syslog.ident = php-fpm
[25-Feb-2024 20:25:25] NOTICE:  syslog.facility = 24
[25-Feb-2024 20:25:25] NOTICE:  log_buffering = yes
[25-Feb-2024 20:25:25] NOTICE:  log_level = unknown value
[25-Feb-2024 20:25:25] NOTICE:  log_limit = 1024
[25-Feb-2024 20:25:25] NOTICE:  emergency_restart_interval = 0s
[25-Feb-2024 20:25:25] NOTICE:  emergency_restart_threshold = 0
[25-Feb-2024 20:25:25] NOTICE:  process_control_timeout = 0s
[25-Feb-2024 20:25:25] NOTICE:  process.max = 0
[25-Feb-2024 20:25:25] NOTICE:  process.priority = undefined
[25-Feb-2024 20:25:25] NOTICE:  daemonize = yes
[25-Feb-2024 20:25:25] NOTICE:  rlimit_files = 0
[25-Feb-2024 20:25:25] NOTICE:  rlimit_core = 0
[25-Feb-2024 20:25:25] NOTICE:  events.mechanism = epoll
[25-Feb-2024 20:25:25] NOTICE:  systemd_interval = 10s
[25-Feb-2024 20:25:25] NOTICE:  
[25-Feb-2024 20:29:38] NOTICE: [www]
[25-Feb-2024 20:29:38] NOTICE:  prefix = undefined
[25-Feb-2024 20:29:38] NOTICE:  user = www-data
[25-Feb-2024 20:29:38] NOTICE:  group = www-data
[25-Feb-2024 20:29:38] NOTICE:  listen = /run/php/php8.2-fpm.sock
[25-Feb-2024 20:29:38] NOTICE:  listen.backlog = -1
[25-Feb-2024 20:29:38] NOTICE:  listen.acl_users = undefined
[25-Feb-2024 20:29:38] NOTICE:  listen.acl_groups = undefined
[25-Feb-2024 20:29:38] NOTICE:  listen.owner = www-data
[25-Feb-2024 20:29:38] NOTICE:  listen.group = www-data
[25-Feb-2024 20:29:38] NOTICE:  listen.mode = undefined
[25-Feb-2024 20:29:38] NOTICE:  listen.allowed_clients = undefined
[25-Feb-2024 20:29:38] NOTICE:  process.priority = undefined
[25-Feb-2024 20:29:38] NOTICE:  process.dumpable = no
[25-Feb-2024 20:29:38] NOTICE:  pm = dynamic
[25-Feb-2024 20:29:38] NOTICE:  pm.max_children = 4
[25-Feb-2024 20:29:38] NOTICE:  pm.start_servers = 1
[25-Feb-2024 20:29:38] NOTICE:  pm.min_spare_servers = 1
[25-Feb-2024 20:29:38] NOTICE:  pm.max_spare_servers = 1
[25-Feb-2024 20:29:38] NOTICE:  pm.max_spawn_rate = 32
[25-Feb-2024 20:29:38] NOTICE:  pm.process_idle_timeout = 10
[25-Feb-2024 20:29:38] NOTICE:  pm.max_requests = 1000
[25-Feb-2024 20:29:38] NOTICE:  pm.status_path = undefined
[25-Feb-2024 20:29:38] NOTICE:  pm.status_listen = undefined
[25-Feb-2024 20:29:38] NOTICE:  ping.path = undefined
[25-Feb-2024 20:29:38] NOTICE:  ping.response = undefined
[25-Feb-2024 20:29:38] NOTICE:  access.log = undefined
[25-Feb-2024 20:29:38] NOTICE:  access.format = undefined
[25-Feb-2024 20:29:38] NOTICE:  slowlog = undefined
[25-Feb-2024 20:29:38] NOTICE:  request_slowlog_timeout = 0s
[25-Feb-2024 20:29:38] NOTICE:  request_slowlog_trace_depth = 20
[25-Feb-2024 20:29:38] NOTICE:  request_terminate_timeout = 0s
[25-Feb-2024 20:29:38] NOTICE:  request_terminate_timeout_track_finished = no
[25-Feb-2024 20:29:38] NOTICE:  rlimit_files = 0
[25-Feb-2024 20:29:38] NOTICE:  rlimit_core = 0
[25-Feb-2024 20:29:38] NOTICE:  chroot = undefined
[25-Feb-2024 20:29:38] NOTICE:  chdir = undefined
[25-Feb-2024 20:29:38] NOTICE:  catch_workers_output = no
[25-Feb-2024 20:29:38] NOTICE:  decorate_workers_output = yes
[25-Feb-2024 20:29:38] NOTICE:  clear_env = yes
[25-Feb-2024 20:29:38] NOTICE:  security.limit_extensions = .php .phar
[25-Feb-2024 20:29:38] NOTICE:  
[25-Feb-2024 20:29:38] NOTICE: configuration file /etc/php/8.2/fpm/php-fpm.conf test is successful

This can be parsed using the ini parser and some pre-processing:

php-fpm8.2 -tt |& sed 's/.*NOTICE://' | sed 's/configuration file.*//' | jc --ini -p
{
  "global": {
    "pid": "/run/php/php8.2-fpm.pid",
    "error_log": "/var/log/php8.2-fpm.log",
    "syslog.ident": "php-fpm",
    "syslog.facility": "24",
    "log_buffering": "yes",
    "log_level": "unknown value",
    "log_limit": "1024",
    "emergency_restart_interval": "0s",
    "emergency_restart_threshold": "0",
    "process_control_timeout": "0s",
    "process.max": "0",
    "process.priority": "undefined",
    "daemonize": "yes",
    "rlimit_files": "0",
    "rlimit_core": "0",
    "events.mechanism": "epoll",
    "systemd_interval": "10s"
  },
  "www": {
    "prefix": "undefined",
    "user": "www-data",
    "group": "www-data",
    "listen": "/run/php/php8.2-fpm.sock",
    "listen.backlog": "-1",
    "listen.acl_users": "undefined",
    "listen.acl_groups": "undefined",
    "listen.owner": "www-data",
    "listen.group": "www-data",
    "listen.mode": "undefined",
    "listen.allowed_clients": "undefined",
    "process.priority": "undefined",
    "process.dumpable": "no",
    "pm": "dynamic",
    "pm.max_children": "4",
    "pm.start_servers": "1",
    "pm.min_spare_servers": "1",
    "pm.max_spare_servers": "1",
    "pm.max_spawn_rate": "32",
    "pm.process_idle_timeout": "10",
    "pm.max_requests": "1000",
    "pm.status_path": "undefined",
    "pm.status_listen": "undefined",
    "ping.path": "undefined",
    "ping.response": "undefined",
    "access.log": "undefined",
    "access.format": "undefined",
    "slowlog": "undefined",
    "request_slowlog_timeout": "0s",
    "request_slowlog_trace_depth": "20",
    "request_terminate_timeout": "0s",
    "request_terminate_timeout_track_finished": "no",
    "rlimit_files": "0",
    "rlimit_core": "0",
    "chroot": "undefined",
    "chdir": "undefined",
    "catch_workers_output": "no",
    "decorate_workers_output": "yes",
    "clear_env": "yes",
    "security.limit_extensions": ".php .phar"
  }
}

Would this be a suitable candidate for a dedicated parser?

貢獻者指南