Merge pull request #561 from FlowiseAI/bugfix/LogPath
Feature/JSONL Logs Cleanup
This commit is contained in:
commit
fe6c56a869
|
|
@ -128,16 +128,16 @@ FLOWISE_PASSWORD=1234
|
||||||
|
|
||||||
## 🌱 Env Variables
|
## 🌱 Env Variables
|
||||||
|
|
||||||
Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder.
|
Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://docs.flowiseai.com/environment-variables)
|
||||||
|
|
||||||
| Variable | Description | Type | Default |
|
| Variable | Description | Type | Default |
|
||||||
| ---------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
|
| ---------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
|
||||||
| PORT | The HTTP port Flowise runs on | Number | 3000 |
|
| PORT | The HTTP port Flowise runs on | Number | 3000 |
|
||||||
| FLOWISE_USERNAME | Username to login | String |
|
| FLOWISE_USERNAME | Username to login | String |
|
||||||
| FLOWISE_PASSWORD | Password to login | String |
|
| FLOWISE_PASSWORD | Password to login | String |
|
||||||
| DEBUG | Print logs from components | Boolean |
|
| DEBUG | Print logs onto terminal/console | Boolean |
|
||||||
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/packages/server` |
|
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/packages/server` |
|
||||||
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
|
| LOG_LEVEL | Different log levels for loggers to be saved | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
|
||||||
| DATABASE_PATH | Location where database is saved | String | `your-home-dir/.flowise` |
|
| DATABASE_PATH | Location where database is saved | String | `your-home-dir/.flowise` |
|
||||||
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
|
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
|
||||||
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
|
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
DATABASE_PATH=/root/.flowise
|
||||||
|
APIKEY_PATH=/root/.flowise
|
||||||
|
LOG_PATH=/root/.flowise/logs
|
||||||
# FLOWISE_USERNAME=user
|
# FLOWISE_USERNAME=user
|
||||||
# FLOWISE_PASSWORD=1234
|
# FLOWISE_PASSWORD=1234
|
||||||
# DEBUG=true
|
# DEBUG=true
|
||||||
# DATABASE_PATH=/your_database_path/.flowise
|
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
|
||||||
# APIKEY_PATH=/your_api_key_path/.flowise
|
|
||||||
# LOG_PATH=/your_log_path/logs
|
|
||||||
# EXECUTION_MODE=child or main
|
# EXECUTION_MODE=child or main
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/f
|
||||||
3. Open [http://localhost:3000](http://localhost:3000)
|
3. Open [http://localhost:3000](http://localhost:3000)
|
||||||
4. You can bring the containers down by `docker-compose stop`
|
4. You can bring the containers down by `docker-compose stop`
|
||||||
|
|
||||||
## With Authrorization
|
## 🔒 Authrorization
|
||||||
|
|
||||||
1. Create `.env` file and specify the `PORT`, `FLOWISE_USERNAME`, and `FLOWISE_PASSWORD` (refer to `.env.example`)
|
1. Create `.env` file and specify the `PORT`, `FLOWISE_USERNAME`, and `FLOWISE_PASSWORD` (refer to `.env.example`)
|
||||||
2. Pass `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `docker-compose.yml` file:
|
2. Pass `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `docker-compose.yml` file:
|
||||||
|
|
@ -22,3 +22,25 @@ Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/f
|
||||||
3. `docker-compose up -d`
|
3. `docker-compose up -d`
|
||||||
4. Open [http://localhost:3000](http://localhost:3000)
|
4. Open [http://localhost:3000](http://localhost:3000)
|
||||||
5. You can bring the containers down by `docker-compose stop`
|
5. You can bring the containers down by `docker-compose stop`
|
||||||
|
|
||||||
|
## 🌱 Env Variables
|
||||||
|
|
||||||
|
If you like to persist your data (flows, logs, apikeys), set these variables in the `.env` file inside `docker` folder:
|
||||||
|
|
||||||
|
- DATABASE_PATH=/root/.flowise
|
||||||
|
- APIKEY_PATH=/root/.flowise
|
||||||
|
- LOG_PATH=/root/.flowise/logs
|
||||||
|
|
||||||
|
Flowise also support different environment variables to configure your instance. Read [more](https://docs.flowiseai.com/environment-variables)
|
||||||
|
|
||||||
|
| Variable | Description | Type | Default |
|
||||||
|
| ---------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
|
||||||
|
| PORT | The HTTP port Flowise runs on | Number | 3000 |
|
||||||
|
| FLOWISE_USERNAME | Username to login | String |
|
||||||
|
| FLOWISE_PASSWORD | Password to login | String |
|
||||||
|
| DEBUG | Print logs onto terminal/console | Boolean |
|
||||||
|
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/packages/server` |
|
||||||
|
| LOG_LEVEL | Different log levels for loggers to be saved | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
|
||||||
|
| DATABASE_PATH | Location where database is saved | String | `your-home-dir/.flowise` |
|
||||||
|
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
|
||||||
|
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,12 @@ services:
|
||||||
- PORT=${PORT}
|
- PORT=${PORT}
|
||||||
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
|
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
|
||||||
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
|
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
|
||||||
|
- DEBUG=${DEBUG}
|
||||||
- DATABASE_PATH=${DATABASE_PATH}
|
- DATABASE_PATH=${DATABASE_PATH}
|
||||||
- APIKEY_PATH=${APIKEY_PATH}
|
- APIKEY_PATH=${APIKEY_PATH}
|
||||||
- LOG_PATH=${LOG_PATH}
|
- LOG_PATH=${LOG_PATH}
|
||||||
|
- LOG_LEVEL=${LOG_LEVEL}
|
||||||
- EXECUTION_MODE=${EXECUTION_MODE}
|
- EXECUTION_MODE=${EXECUTION_MODE}
|
||||||
- DEBUG=${DEBUG}
|
|
||||||
ports:
|
ports:
|
||||||
- '${PORT}:${PORT}'
|
- '${PORT}:${PORT}'
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,6 @@ PORT=3000
|
||||||
# DEBUG=true
|
# DEBUG=true
|
||||||
# DATABASE_PATH=/your_database_path/.flowise
|
# DATABASE_PATH=/your_database_path/.flowise
|
||||||
# APIKEY_PATH=/your_api_key_path/.flowise
|
# APIKEY_PATH=/your_api_key_path/.flowise
|
||||||
# LOG_PATH=/your_log_path/logs
|
# LOG_PATH=/your_log_path/.flowise/logs
|
||||||
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
|
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
|
||||||
# EXECUTION_MODE=main (child | main)
|
# EXECUTION_MODE=main (child | main)
|
||||||
|
|
|
||||||
|
|
@ -31,16 +31,16 @@ FLOWISE_PASSWORD=1234
|
||||||
|
|
||||||
## 🌱 Env Variables
|
## 🌱 Env Variables
|
||||||
|
|
||||||
Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder.
|
Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://docs.flowiseai.com/environment-variables)
|
||||||
|
|
||||||
| Variable | Description | Type | Default |
|
| Variable | Description | Type | Default |
|
||||||
| ---------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
|
| ---------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
|
||||||
| PORT | The HTTP port Flowise runs on | Number | 3000 |
|
| PORT | The HTTP port Flowise runs on | Number | 3000 |
|
||||||
| FLOWISE_USERNAME | Username to login | String |
|
| FLOWISE_USERNAME | Username to login | String |
|
||||||
| FLOWISE_PASSWORD | Password to login | String |
|
| FLOWISE_PASSWORD | Password to login | String |
|
||||||
| DEBUG | Print logs from components | Boolean |
|
| DEBUG | Print logs onto terminal/console | Boolean |
|
||||||
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/packages/server` |
|
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/packages/server` |
|
||||||
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
|
| LOG_LEVEL | Different log levels for loggers to be saved | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
|
||||||
| DATABASE_PATH | Location where database is saved | String | `your-home-dir/.flowise` |
|
| DATABASE_PATH | Location where database is saved | String | `your-home-dir/.flowise` |
|
||||||
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
|
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
|
||||||
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
|
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,6 @@ export class App {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.app = express()
|
this.app = express()
|
||||||
|
|
||||||
// Add the expressRequestLogger middleware to log all requests
|
|
||||||
this.app.use(expressRequestLogger)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async initDatabase() {
|
async initDatabase() {
|
||||||
|
|
@ -93,6 +90,9 @@ export class App {
|
||||||
// Allow access from *
|
// Allow access from *
|
||||||
this.app.use(cors())
|
this.app.use(cors())
|
||||||
|
|
||||||
|
// Add the expressRequestLogger middleware to log all requests
|
||||||
|
this.app.use(expressRequestLogger)
|
||||||
|
|
||||||
if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
|
if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
|
||||||
const username = process.env.FLOWISE_USERNAME
|
const username = process.env.FLOWISE_USERNAME
|
||||||
const password = process.env.FLOWISE_PASSWORD
|
const password = process.env.FLOWISE_PASSWORD
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ const logger = createLogger({
|
||||||
* this.app.use(expressRequestLogger)
|
* this.app.use(expressRequestLogger)
|
||||||
*/
|
*/
|
||||||
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
||||||
|
const unwantedLogURLs = ['/api/v1/node-icon/']
|
||||||
|
if (req.url.includes('/api/v1/') && !unwantedLogURLs.some((url) => req.url.includes(url))) {
|
||||||
const fileLogger = createLogger({
|
const fileLogger = createLogger({
|
||||||
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
||||||
defaultMeta: {
|
defaultMeta: {
|
||||||
|
|
@ -95,6 +97,7 @@ export function expressRequestLogger(req: Request, res: Response, next: NextFunc
|
||||||
} else {
|
} else {
|
||||||
fileLogger.http(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
fileLogger.http(`${getRequestEmoji(req.method)} ${req.method} ${req.url}`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue