How to tell CockroachDB to write logs in an external (dedicated) directory?

Hi

Question:
I would like to store the logs of CockroachDB in a dedicated directory outside of the one defined by the “–store” parameter => is it possible, if yes how?
(excluding solutions referring to symlinks => something more “standard” pls )

It’s a simple thing but I swear that I didn’t find anything that was in my opinion relevant when doing direct searches in this forum nor in Google :expressionless:

Background infos:
1- Start script
This is the script that I’m currently using to start CRDB (pls. ignore the GiBs - absolutely temporary - I set them just to do an initial startup test ):

/some_dir/cockroachdb start-single-node \
--advertise-host=somehost \
--log-config-file=/some_dir/logging.yaml \
--store=path=/another_dir/crdb/storage,attrs=hdd,size=.95 \
--temp-dir=/another_dir/crdb/temp \
--cache=2GiB \
--max-sql-memory=1GiB \
--external-io-dir=/another_dir/crdb/ext_io \
--max-disk-temp-storage=10GiB \
--listen-addr=192.168.123.123:56257 \
--http-addr=192.168.123.123:58765 \
--certs-dir=/some_dir/certs

2- Result after executing the start-script from a new/blank setup:

├── ext_io
├── storage
│ ├── 000002.log
│ ├── 000004.log
│ ├── 000005.log
│ ├── 000006.log
│ ├── 000007.log
│ ├── auxiliary
│ ├── cockroach.advertise-addr
│ ├── cockroach.advertise-sql-addr
│ ├── cockroach.http-addr
│ ├── cockroach.listen-addr
│ ├── cockroach.sql-addr
│ ├── CURRENT
│ ├── LOCK
│ ├── logs
│ │ ├── cockroachdb.log → cockroachdb.somehost.root.2021-07-15T21_34_14Z.000935.log
│ │ ├── cockroachdb-pebble.log → cockroachdb-pebble.somehost.root.2021-07-15T21_34_14Z.000935.log
│ │ ├── cockroachdb-pebble.somehost.root.2021-07-15T21_34_14Z.000935.log
│ │ ├── cockroachdb-stderr.log → cockroachdb-stderr.somehost.root.2021-07-15T21_34_14Z.000935.log
│ │ ├── cockroachdb-stderr.somehost.root.2021-07-15T21_34_14Z.000935.log
│ │ ├── cockroachdb.somehost.root.2021-07-15T21_34_14Z.000935.log
│ │ ├── goroutine_dump
│ │ └── heap_profiler
│ │ ├── memprof.2021-07-15T21_34_25.454.26792304.pprof
│ │ ├── memprof.2021-07-15T21_34_45.454.31784376.pprof
│ │ ├── memprof.2021-07-15T21_35_05.455.33939320.pprof
│ │ ├── memprof.2021-07-15T21_35_25.455.34232192.pprof
│ │ ├── memprof.2021-07-15T21_35_55.456.38781520.pprof
│ │ ├── memstats.2021-07-15T21_36_15.457.180666368.txt
│ │ ├── memstats.2021-07-15T21_36_25.457.184557568.txt
│ │ ├── memstats.2021-07-15T21_36_35.457.185094144.txt
│ │ ├── memstats.2021-07-15T21_36_45.457.185352192.txt
│ │ └── memstats.2021-07-15T21_36_55.457.186245120.txt
│ ├── MANIFEST-000001
│ ├── OPTIONS-000003
│ └── temp-dirs-record.txt
└── temp

3- Issue
I have in my tiny server 1 SSD and 3 HDDs (grouped as a ZFS RAIDZ1):
I would like to use the HDDs to store the (permanent) data and the SSD to store non-permanent data.

I don’t want the HDDs to get the “interference” caused by the logs (which would lower the overall DB performance), therefore I’d like to store the logs in a different location (which would use a different medium, referring to the SSD).

Thx for reading.
Cheers :slight_smile:

1 Like

Hello! This might be what you’re looking for: Configure logs | CockroachDB Docs

Thanks a lot! Damn, I did configure the logging but totally overlooked that “dir”-parameter… → I set it → it works.
Sorry for the stupid post :stuck_out_tongue:

1 Like

Oh, it’s not a stupid post at all! It wasn’t intuitive to me either…I had to ask our engineering team for help :grinning_face_with_smiling_eyes:

2 Likes