You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/11/23 23:02:43 UTC

[GitHub] [apisix] ederparaiso opened a new issue, #8387: help request: how to configure file-log plugin

ederparaiso opened a new issue, #8387:
URL: https://github.com/apache/apisix/issues/8387

   ### Description
   
   Hi, as posted on slack forum, I'm trying to configure file-log plugin in apisix (version 3.0.0)
   It doesn't show any erros but  no file.log file was created in /usr/local/apisix/logs. Is this the root directory when I specify a relative path in file-log configuration path? What I'm still doing wrong? 
   
   Also, I just want to understand why, by default, (in my tests at least) /usr/local/apisix/logs is created with root permissions even if I don't map it to a external volume. Should this directory have write persmissions to apisix user by default?
   
   Thanks in advance!
   
   compose file
   ```yaml
   version: '3.7'
   
   services:
     apisix-dashboard:
       image: apache/apisix-dashboard:2.13-alpine
       container_name: apisix-dashboard
       restart: always
       volumes:
       - ./dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
       ports:
       - "9000:9000"
       networks:
         - apisix_network
   
     apisix:
       image: apache/apisix:3.0.0-debian
       container_name: apisix
       restart: always
       volumes:
         - ./apisix_log:/usr/local/apisix/logs
         - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
       depends_on:
         - etcd
       ports:
         - "9180:9180/tcp"
         - "9080:9080/tcp"
         - "9091:9091/tcp"
         - "9443:9443/tcp"
         - "9092:9092/tcp"
       networks:
         - apisix_network
   
     etcd:
       image: bitnami/etcd:3.4.15
       container_name: etcd
       restart: always
       volumes:
         - etcd_data:/bitnami/etcd
       environment:
         ETCD_ENABLE_V2: "true"
         ALLOW_NONE_AUTHENTICATION: "yes"
         ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379/"
         ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379/"
       ports:
         - "2379:2379/tcp"
       networks:
         - apisix_network
   
   networks:
     apisix_network:
       driver: bridge
       external: true
   
   volumes:
     etcd_data:
       driver: local
    ```
   
   route/plugin configs
   ```json
   {
     "uri": "/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8",
     "name": "test",
     "plugins": {
       "file-logger": {
         "path": "logs/file.log"
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "run.mocky.io",
           "port": 443,
           "weight": 1
         }
       ],
       "type": "roundrobin",
       "hash_on": "vars",
       "scheme": "https",
       "pass_host": "pass"
     },
     "status": 1
   }
   ```
   
   example
   ```sh
   curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 -H "Host: http://run.mocky.io/"
   ```
   
   
   
   
   ### Environment
   
   - APISIX version 3.0.0-debian (run via docker image)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tzssangglass commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1325897092

   try with
   
   ```json
     "file-logger": {
         "path": "file.log"
     }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1325901513

   I just copy and paste the route config you provided. And nothing was wrong.
   
   This is my docker-compose config
   ```
   version: "3"
   
   services:
     apisix-dashboard:
       image: apache/apisix-dashboard:2.13-alpine
       restart: always
       volumes:
       - ./dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
       ports:
       - "9000:9000"
       networks:
         apisix:
   
     apisix:
       image: apache/apisix:latest
       restart: always
       volumes:
         - ./apisix_log:/usr/local/apisix/logs
         - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
       depends_on:
         - etcd
       ##network_mode: host
       ports:
         - "9180:9180/tcp"
         - "9080:9080/tcp"
         - "9091:9091/tcp"
         - "9443:9443/tcp"
         - "9092:9092/tcp"
       networks:
         apisix:
   
     etcd:
       image: bitnami/etcd:3.4.15
       restart: always
       volumes:
         - etcd_data:/bitnami/etcd
       environment:
         ETCD_ENABLE_V2: "true"
         ALLOW_NONE_AUTHENTICATION: "yes"
         ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
         ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
       ports:
         - "2379:2379/tcp"
       networks:
         apisix:
   
     web1:
       image: nginx:1.19.0-alpine
       restart: always
       volumes:
         - ./upstream/web1.conf:/etc/nginx/nginx.conf
       ports:
         - "9081:80/tcp"
       environment:
         - NGINX_PORT=80
       networks:
         apisix:
   
     web2:
       image: nginx:1.19.0-alpine
       restart: always
       volumes:
         - ./upstream/web2.conf:/etc/nginx/nginx.conf
       ports:
         - "9082:80/tcp"
       environment:
         - NGINX_PORT=80
       networks:
         apisix:
   
     prometheus:
       image: prom/prometheus:v2.25.0
       restart: always
       volumes:
         - ./prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.yml
       ports:
         - "9090:9090"
       networks:
         apisix:
   
     grafana:
       image: grafana/grafana:7.3.7
       restart: always
       ports:
         - "3000:3000"
       volumes:
         - "./grafana_conf/provisioning:/etc/grafana/provisioning"
         - "./grafana_conf/dashboards:/var/lib/grafana/dashboards"
         - "./grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini"
       networks:
         apisix:
   
   networks:
     apisix:
       driver: bridge
   
   volumes:
     etcd_data:
       driver: local
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ederparaiso commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
ederparaiso commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1327937707

   Excellent, I'll provide my steps. Ah, sorry about host confusion on curl. It was a ctrl-c ctrl-v error when I copied curl command from slack chat. 
   
   **Some system infos:**
   
   ```sh
   $ hostnamectl
   Operating System: Ubuntu 20.04.5 LTS
             Kernel: Linux 5.15.0-53-generic
       Architecture: x86-64
   
   $ docker --version
   Docker version 20.10.21, build baeda1f
   
   $ docker-compose --version
   docker-compose version 1.29.2, build 5becea4c
   ```
   
   **Step by step**
   (I used the last provided file samples as you recommended. Also I pushed them to a public repo here https://github.com/ederparaiso/apisix-log-test
   
   start environment
   ```sh
   $ docker-compose up
   $ docker ps
   CONTAINER ID   IMAGE                                 COMMAND                  CREATED          STATUS          PORTS                                                                                                                                                                                            NAMES
   0c219c343ebe   apache/apisix:3.0.0-debian            "/docker-entrypoint.…"   10 minutes ago   Up 10 minutes   0.0.0.0:9080->9080/tcp, :::9080->9080/tcp, 0.0.0.0:9091-9092->9091-9092/tcp, :::9091-9092->9091-9092/tcp, 0.0.0.0:9180->9180/tcp, :::9180->9180/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp   apisix-log-test_apisix_1
   7a496f39b341   bitnami/etcd:3.4.15                   "/opt/bitnami/script…"   10 minutes ago   Up 10 minutes   0.0.0.0:2379->2379/tcp, :::2379->2379/tcp, 2380/tcp                                                                                                                                              apisix-log-test_etcd_1
   edb7a836faff   apache/apisix-dashboard:2.13-alpine   "/usr/local/apisix-d…"   10 minutes ago   Up 10 minutes   0.0.0.0:9000->9000/tcp, :::9000->9000/tcp                                                                                                                                                        apisix-log-test_apisix-dashboard_1
   ```
   
   check route does not exists
   ```sh
   $ curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8
   HTTP/1.1 404 Not Found
   Date: Fri, 25 Nov 2022 23:43:33 GMT
   Content-Type: text/plain; charset=utf-8
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX/3.0.0
   
   {"error_msg":"404 Route Not Found"}
   ```
   
   create route
   ```
   $ curl -i -X POST \
   >    -H "X-API-KEY:edd1c9f034335f136f87ad84b625c8f1" \
   >    -H "Content-Type:application/json" \
   >    -d \
   > '{
   >   "uri": "/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8",
   >   "name": "test",
   >   "plugins": {
   >     "file-logger": {
   >       "path": "logs/file.log"
   >     }
   >   },
   >   "upstream": {
   >     "nodes": [
   >       {
   >         "host": "run.mocky.io",
   >         "port": 443,
   >         "weight": 1
   >       }
   >     ],
   >     "type": "roundrobin",
   >     "hash_on": "vars",
   >     "scheme": "https",
   >     "pass_host": "pass"
   >   },
   >   "status": 1
   > }' \
   >  'http://127.0.0.1:9180/apisix/admin/routes'
   HTTP/1.1 201 Created
   Date: Fri, 25 Nov 2022 23:46:40 GMT
   Content-Type: application/json
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX/3.0.0
   Access-Control-Allow-Origin: *
   Access-Control-Allow-Credentials: true
   Access-Control-Expose-Headers: *
   Access-Control-Max-Age: 3600
   X-API-VERSION: v3
   
   {"key":"\/apisix\/routes\/00000000000000000046","value":{"status":1,"name":"test","create_time":1669420000,"priority":0,"update_time":1669420000,"plugins":{"file-logger":{"path":"logs\/file.log"}},"uri":"\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8","id":"00000000000000000046","upstream":{"hash_on":"vars","pass_host":"pass","scheme":"https","nodes":[{"port":443,"priority":0,"host":"run.mocky.io","weight":1}],"type":"roundrobin"}}}
   ```
   
   try to consume (without host header)
   ```sh
   $ curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8
   HTTP/1.1 404 Not Found
   Content-Type: text/html; charset=utf-8
   Transfer-Encoding: chunked
   Connection: keep-alive
   Cache-Control: no-cache
   X-CleverCloudUpgrade: true
   Server: APISIX/3.0.0
   
   <!DOCTYPE HTML>
   <html lang="en">
   omited...
   ```
   
   adding host header **without any changes on route config**
   ```
   $ curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 -H "Host: run.mocky.io"
   HTTP/1.1 200 OK
   Content-Type: application/json; charset=UTF-8
   Content-Length: 16
   Connection: keep-alive
   Date: Fri, 25 Nov 2022 23:50:13 GMT
   Sozu-Id: 01GJRK5RZRFKEWGBDRREXFDE0Q
   Server: APISIX/3.0.0
   
   {"result": "ok"}
   ```
   
   lookup for file.log
   ```sh
   $ ls -l apisix_log/
   total 60
   -rw-r--r-- 1 root root  1802 nov 25 20:50 access.log
   -rw-r--r-- 1 root root 50685 nov 25 20:50 error.log
   -rw-r--r-- 1 root root     2 nov 25 20:30 nginx.pid
   ```
   
   check logs
   ```sh
   $ cat apisix_log/access.log
   172.25.0.1 - - [25/Nov/2022:23:48:14 +0000] 127.0.0.1:9080 "GET /v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 HTTP/1.1" 404 1436 1.613 "-" "curl/7.68.0" 185.42.117.108:443 404 1.583 "https://127.0.0.1:9080"
   172.25.0.1 - - [25/Nov/2022:23:50:14 +0000] run.mocky.io "GET /v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 HTTP/1.1" 200 16 1.151 "-" "curl/7.68.0" 46.252.181.103:443 200 1.127 "https://run.mocky.io"
   ```
   
   lookup for errors
   ```sh
   $ cat apisix_log/error.log | grep error
   2022/11/25 23:50:14 [error] 53#53: *138861 [lua] file-logger.lua:117: write_file_data(): failed to open file: logs/file.log, error info: logs/file.log: Permission denied while logging request, client: 172.25.0.1, server: _, request: "GET /v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 HTTP/1.1", upstream: "https://46.252.181.103:443/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8", host: "run.mocky.io"
   ```
   
   check apisix routes
   ```sh
   $ curl -i -H "X-API-KEY:edd1c9f034335f136f87ad84b625c8f1" 'http://127.0.0.1:9180/apisix/admin/routes' 
   HTTP/1.1 200 OK
   Date: Sat, 26 Nov 2022 00:13:16 GMT
   Content-Type: application/json
   Transfer-Encoding: chunked
   Connection: keep-alive
   Server: APISIX/3.0.0
   Access-Control-Allow-Origin: *
   Access-Control-Allow-Credentials: true
   Access-Control-Expose-Headers: *
   Access-Control-Max-Age: 3600
   X-API-VERSION: v3
   
   {"total":1,"list":[{"modifiedIndex":47,"createdIndex":47,"key":"\/apisix\/routes\/00000000000000000046","value":{"status":1,"name":"test","create_time":1669420000,"priority":0,"update_time":1669420000,"plugins":{"file-logger":{"path":"logs\/file.log"}},"upstream":{"hash_on":"vars","pass_host":"pass","scheme":"https","nodes":[{"port":443,"priority":0,"host":"run.mocky.io","weight":1}],"type":"roundrobin"},"id":"00000000000000000046","uri":"\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8"}}]}
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] shreemaan-abhishek commented on issue #8387: help request: how to configure file-log plugin

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1707971147

   Do you have any further questions/updates? If not, please close the issue. Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1326933867

   I try using `apache/apisix:3.0.0-debian` image, still, work for me.
   
   docker compose config
   ```yaml
   version: "3"
   
   services:
     apisix-dashboard:
       image: apache/apisix-dashboard:2.13-alpine
       restart: always
       volumes:
       - ./dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
       ports:
       - "9000:9000"
       networks:
         apisix:
   
     apisix:
       image: apache/apisix:3.0.0-debian
       restart: always
       volumes:
         - ./apisix_log:/usr/local/apisix/logs
         - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
       depends_on:
         - etcd
       ##network_mode: host
       ports:
         - "9180:9180/tcp"
         - "9080:9080/tcp"
         - "9091:9091/tcp"
         - "9443:9443/tcp"
         - "9092:9092/tcp"
       networks:
         apisix:
   
     etcd:
       image: bitnami/etcd:3.4.15
       restart: always
       volumes:
         - etcd_data:/bitnami/etcd
       environment:
         ETCD_ENABLE_V2: "true"
         ALLOW_NONE_AUTHENTICATION: "yes"
         ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
         ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
       ports:
         - "2379:2379/tcp"
       networks:
         apisix:
   
   networks:
     apisix:
       driver: bridge
   
   volumes:
     etcd_data:
       driver: local
   ```
   
   post route config (your version)
   ```shell
   curl -i -X POST \
      -H "X-API-KEY:edd1c9f034335f136f87ad84b625c8f1" \
      -H "Content-Type:application/json" \
      -d \
   '{
     "uri": "/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8",
     "name": "test",
     "plugins": {
       "file-logger": {
         "path": "logs/file.log"
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "run.mocky.io",
           "port": 443,
           "weight": 1
         }
       ],
       "type": "roundrobin",
       "hash_on": "vars",
       "scheme": "https",
       "pass_host": "pass"
     },
     "status": 1
   }' \
    'http://127.0.0.1:9180/apisix/admin/routes'
   ```
   
   try access this route using curl
   
   ```
   curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8
   ```
   
   and look at file log
   
   ```json
   ➜  tail -n1 file.log                                                    
   {"service_id":"","apisix_latency":1290.9998645782,"request":{"url":"http:\/\/127.0.0.1:9080\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8","querystring":{},"method":"GET","uri":"\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8","size":117,"headers":{"user-agent":"curl\/7.84.0","host":"127.0.0.1:9080","accept":"*\/*"}},"response":{"size":1629,"status":404,"headers":{"content-type":"text\/html; charset=utf-8","x-clevercloudupgrade":"true","cache-control":"no-cache","server":"APISIX\/3.0.0","transfer-encoding":"chunked","connection":"close"}},"upstream_latency":1326,"route_id":"00000000000000000015","latency":2616.9998645782,"start_time":1669339166647,"upstream":"185.42.117.109:443","server":{"hostname":"4797f0986fd0","version":"3.0.0"},"client_ip":"172.20.0.1"}
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1328402999

   Sorry for response later, let me try your step


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ederparaiso commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
ederparaiso commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1326398783

   Hi @mscb402 , thanks for your attention! I noted that you are using the latest version of apisix image.
   ```yaml
   image: apache/apisix:latest
   ```
   
   I'm using 
   ```yaml
   image: apache/apisix:3.0.0-debian
   ```
   
   Maybe its a problem with this version... Also, in this version, if a make curl request without host header I receive a 404 error. I agree with you but what is happening is the opposite (with my original config)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ederparaiso commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
ederparaiso commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1326515245

   Also I noted that I'm using only apisix, etc and dashboard instances. I don't think so but it worth to ask: It prometheus is necessary to file-log works?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1326942736

   So why add `HOST` will mismatch route? Because your does not config host in route config. If you are using dashboard, you should config host
   <img width="508" alt="image" src="https://user-images.githubusercontent.com/11229089/203884181-834c751c-24ff-406a-8fda-d075739d967f.png">
   if you using config curl to config route. You should using this
   ```
   curl -i -X POST \
      -H "X-API-KEY:edd1c9f034335f136f87ad84b625c8f1" \
      -H "Content-Type:application/json" \
      -d \
   '{
     "uri": "/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8",
     "name": "test",
     "host": "run.mocky.io",
     "plugins": {
       "file-logger": {
         "path": "logs/file.log"
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "run.mocky.io",
           "port": 443,
           "weight": 1
         }
       ],
       "type": "roundrobin",
       "hash_on": "vars",
       "scheme": "https",
       "pass_host": "pass"
     },
     "status": 1
   }' \
    'http://127.0.0.1:9180/apisix/admin/routes'
   ```
   Be noticed, I did not change the configuration except for adding a host field `"host": "run.mocky.io",`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1325898262

   I was trying your config at my local docker. Everything is OK! The file can create success in `/usr/local/apisix/logs`.
   <img width="874" alt="image" src="https://user-images.githubusercontent.com/11229089/203686406-41df8db3-7167-49c1-960d-3ef7509ccecb.png">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] shreemaan-abhishek commented on issue #8387: help request: how to configure file-log plugin

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1534539880

   @ederparaiso, please check the default file permission level on your machine:
   
   <img width="866" alt="image" src="https://user-images.githubusercontent.com/61597896/236183240-e9953a6f-1f2b-4170-b1ec-8e16c1138f6d.png">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ederparaiso commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
ederparaiso commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1328989257

   No problems, thanks for all your help! This workaround works fine. Do you know if this behavior is related to wrong environment configuration or if can be an unexpected apisix behavior?
   
   Also, I'm still confused about host param behavior. As I sent in my reproduction steps, it was the opposite of your tests: without host configuration in route object I needed to send Host header.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1329956408

   > No problems, thanks for all your help! This workaround works fine. Do you know if this behavior is related to wrong environment configuration or if can be an unexpected apisix behavior?
   > 
   > Also, I'm still confused about host param behavior. As I sent in my reproduction steps, it was the opposite of your tests: without host configuration in route object I needed to send Host header.
   
   Mabey this is because file-log plugin should create file by yourself. But it still confused me too. At macOS, it works well when a file not be created by myself.
   And `Host` param configuration is good behavior. It also works without a host. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] github-actions[bot] commented on issue #8387: help request: how to configure file-log plugin

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1737091983

   Due to lack of the reporter's response this issue has been labeled with "no response". It will be close in 3 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1325909003

   There is no problem with your configuration, so according to my inference, maybe there is a problem with your usage like you have not accessed this route correctly. So I re-read your description and you are using
   
   `curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 -H "Host: http://run.mocky.io/"`
   
   this command to access this route, which is wrong. Because you didn't configure `HOST` in your route. So you should access route like this
   
   `curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 `
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1325915767

   So maybe you should try this route config
   ```
   {
     "uri": "/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8",
     "name": "test",
     "host": "run.mocky.io",
     "plugins": {
       "file-logger": {
         "path": "logs/file.log"
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "run.mocky.io",
           "port": 443,
           "weight": 1
         }
       ],
       "type": "roundrobin",
       "hash_on": "vars",
       "scheme": "https",
       "pass_host": "pass"
     },
     "status": 1
   }
   ```
   
   keep mind `host` is add to config.
   
   and then access this route from curl
   
   ```
   curl -i http://127.0.0.1:9080/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8 -H "Host: run.mocky.io" 
   ```
   
   there is what you will get
   
   ```
   HTTP/1.1 200 OK
   Content-Type: application/json; charset=UTF-8
   Content-Length: 16
   Connection: keep-alive
   Date: Thu, 24 Nov 2022 03:37:50 GMT
   Sozu-Id: 01GJKVD31W1TN8WFR0NW0NPFJQ
   Server: APISIX/3.0.0
   
   {"result": "ok"}
   ```
   
   And the file log will append:
   ```
   ## tail -n1 file.log
   
   {"response":{"status":200,"size":222,"headers":{"sozu-id":"01GJKVD31W1TN8WFR0NW0NPFJQ","content-length":"16","server":"APISIX\/3.0.0","connection":"close","date":"Thu, 24 Nov 2022 03:37:50 GMT","content-type":"application\/json; charset=UTF-8"}},"apisix_latency":0,"route_id":"00000000000000000032","server":{"hostname":"bd257b6c70bc","version":"3.0.0"},"client_ip":"172.20.0.1","request":{"uri":"\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8","size":115,"querystring":{},"method":"GET","url":"http:\/\/run.mocky.io:9080\/v3\/bc8fdfcd-0392-49fa-8520-c8644d1688c8","headers":{"accept":"*\/*","host":"run.mocky.io","user-agent":"curl\/7.84.0"}},"start_time":1669261068867,"upstream_latency":1702,"latency":1701.9999027252,"service_id":"","upstream":"46.252.181.103:443"}
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1326944898

   So please try out my solution. If you still have a problem, please provide step by step case.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] github-actions[bot] commented on issue #8387: help request: how to configure file-log plugin

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1742028255

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] github-actions[bot] closed issue #8387: help request: how to configure file-log plugin

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #8387: help request: how to configure file-log plugin
URL: https://github.com/apache/apisix/issues/8387


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1326925284

   > Also I noted that I'm using only apisix, etc and dashboard instances. I don't think so but it worth to ask: Is prometheus necessary to file-log works?
   
   prometheus is not necessary for file-log.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ederparaiso commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
ederparaiso commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1327939140

   Be noticed, I did not change the route configuration to add host field as you did here
   
   > So why add `HOST` will mismatch route? Because your does not config host in route config. If you are using dashboard, you should config host <img alt="image" width="508" src="https://user-images.githubusercontent.com/11229089/203884181-834c751c-24ff-406a-8fda-d075739d967f.png"> if you using config curl to config route. You should using this
   > 
   > ```
   > curl -i -X POST \
   >    -H "X-API-KEY:edd1c9f034335f136f87ad84b625c8f1" \
   >    -H "Content-Type:application/json" \
   >    -d \
   > '{
   >   "uri": "/v3/bc8fdfcd-0392-49fa-8520-c8644d1688c8",
   >   "name": "test",
   >   "host": "run.mocky.io",
   >   "plugins": {
   >     "file-logger": {
   >       "path": "logs/file.log"
   >     }
   >   },
   >   "upstream": {
   >     "nodes": [
   >       {
   >         "host": "run.mocky.io",
   >         "port": 443,
   >         "weight": 1
   >       }
   >     ],
   >     "type": "roundrobin",
   >     "hash_on": "vars",
   >     "scheme": "https",
   >     "pass_host": "pass"
   >   },
   >   "status": 1
   > }' \
   >  'http://127.0.0.1:9180/apisix/admin/routes'
   > ```
   > 
   > Be noticed, I did not change the configuration except for adding a host field `"host": "run.mocky.io",`.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8387: help request: how to configure file-log plugin

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8387:
URL: https://github.com/apache/apisix/issues/8387#issuecomment-1328501205

   Hello, I try it. Yes, this is a problem with creating file permission. The simple solution is to create file manually
   ```
   cd apisix_log
   touch file.log
   chmod 777 file.log
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org