Internal Error: Server logs

I ran my query and this error appear:

Status: 500. Message: internal error: An internal error has occurred - check server logs

image

How to solve this error? Thank you

Recommendation is there:

If I’m running grafana in docker, and I followed the standard direction to map a local folder to /var/log/grafana, I would expect the server logs to be located in my local folder. But they’re not.

I can run docker logs grafana to view my server logs, but where in the container would the logs be?

what does your ini file say about the location example mine

# Directory where grafana can store logs
logs = data/log

The solution to this was to use the following environment variables:

# Timezone from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=America/Chicago
# User ID and Group ID
PUID=472
PGID=0
# Directory locations
DIRECTORY_CONFIG=/srv/grafana/config
DIRECTORY_DATA=/srv/grafana/data
DIRECTORY_LOGS=/srv/grafana/logs
# Container specifics
GF_PATHS_LOGS=/var/log/grafana
GF_LOG_MODE=console file
GF_LOG_LEVEL=warn
GF_LOG_CONSOLE_FORMAT=console
GF_LOG_FILE_FORMAT=json
GF_LOG_FILE_LOG_ROTATE=true
GF_LOG_FILE_DAILY_ROTATE=true
GF_LOG_FILE_MAX_DAYS=14

This has enabled logging for both the console and a file.

Here is my compose.yaml file for completeness:

services:
  grafana:
    image: grafana/grafana:latest
    container_name:grafana
    user: "${PUID}:${PGID}"
    ports:
      - ${CONTAINER_PORT1}:3000
    env_file:
      - .env
    volumes:
      - ${DIRECTORY_CONFIG}:/etc/grafana/
      - ${DIRECTORY_DATA}:/var/lib/grafana
      - ${DIRECTORY_LOGS}:/var/log/grafana
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

Now I can see the log file in /srv/grafana/logs/:

$ ls -lha logs/
total 12K
drwxrwxr-x 2   472 root  4.0K Jan 28 13:47 .
drwxrwxr-x 5 idsvc idsvc 4.0K Jan 28 13:47 ..
-rw-r--r-- 1   472 root  1.8K Jan 28 13:47 grafana.log

Hopefully this will help someone else.

1 Like