#Native Harvest: How to change log file location?

1 messages · Page 1 of 1 (latest)

dull escarp
#

Harvest is running on a User which don't have access to /var/log
Can I set another log-file location ?

#

Native Harvest: How to enable log file for non-root user?

#

Native Harvest: How to change log file location?

main axle
#

Can you try setting an environment variable HARVEST_LOGS to a directory where the harvest user has access? Restart Harvest after that and see if it resolves the issue.

main axle
#

No. Just an env variable

#

at OS level

dull escarp
#

set, but no logs are going in

main axle
#

hmm ok let me check in code

#

Can you also add an argument for harvest start command --logtofile
You can also add HARVEST_LOGS with custom dir path i like below in service file like below

Environment="HARVEST_LOGS=/opt/harvest/logs"
ExecStart=${HARVEST_INSTALL_PATH}/harvest-${HARVEST_VERSION}-1_linux_amd64/bin/harvest --config ${HARVEST_INSTALL_PATH}/harvest-${HARVEST_VERSION}-1_linux_amd64/harvest.yml start --logtofile -f %i
dull escarp
#

Thank you, I will try it and let you now.
Other question, is there also a way to monitor the harvest service itself?

main axle
#

Do you mean via systemd? or via some other means?

main axle
solemn raft
#

Hi, i'm working with @dull escarp and responsible for Harvest. We tried your approach with HARVEST_LOGS env variable but it does not work. [Unit]
Description="NetApp Harvest Poller instance %I"
PartOf=harvest.target
After=network-online.target
Wants=network-online.target

[Service]
User=rh18
Group=scripts
Type=simple
Restart=on-failure
Environment="HARVEST_LOGS=/services/netapp/harvest/logs"
WorkingDirectory=/services/netapp/harvest/harvest
Environment="HARVEST_LOGS=/services/netapp/harvest/harvest/log"
ExecStart=/services/netapp/harvest/harvest/bin/harvest --config /services/netapp/harvest/harvest/harvest.yml start --logtofile -f %i

[Install]
WantedBy=harvest.target
root@mcosrv2253:/services/netapp/harvest# ll /services/netapp/harvest/logs
total 0

main axle
#

Could you share permissions for dir /services/netapp/harvest/logs

solemn raft
#

SORRY, i'm a idiot, it runs, just watched in the wrong directory. Thanks for the help

main axle
#

I see there are 2 env variables in file
Environment="HARVEST_LOGS=/services/netapp/harvest/logs"

main axle
dull escarp
main axle
#

You can keep a watch on poller status via systemctl status "poller@*"

solemn raft
#

We have the strange situation that everything runs fine for a couple of days and suddenly ALL pollers are gone (we have 19 actually, Ontap and StorageGRID, all REST based), and we don't know why all pollers are gone.

main axle
#

What is your Harvest version?

solemn raft
#

I suspect in one case it was the upgrade of a StorageGRID Admin Node. But why are then all pollers exiting and not only the one targeting to these admin node?

#

The newest 25.08.1

main axle
#

All pollers of harvest are independent. Issue in 1 poller should not impact others. Could you check if there are any OOM erros?

dmesg | grep -i "killed process"
How much memory do you have available? free -h
also disk space?

solemn raft
#

root@mcosrv2253:/services/netapp/harvest# free -h
total used free shared buff/cache available
Mem: 62Gi 39Gi 3.2Gi 16Mi 20Gi 22Gi
Swap: 4.0Gi 2.0Mi 4.0Gi

#

Diskspace and memory are not the problem, and there is nothing in dmesg output regarding "killed process".

main axle
#

Ok. We'll need to check logs then. See if logs are captured in journal?

journalctl -u "poller*" --no-pager -f

solemn raft
#

root@mcosrv2253:/services/netapp/harvest# journalctl -u "poller*" --no-pager -f
-- Logs begin at Mon 2025-07-28 17:02:24 CEST. --
Nov 03 10:21:35 mcosrv2253 harvest[3950105]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950090]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950115]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950100]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950119]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950190]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950116]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950217]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950203]: starting in foreground, enter CTRL+C or close terminal to stop poller
Nov 03 10:21:35 mcosrv2253 harvest[3950207]: starting in foreground, enter CTRL+C or close terminal to stop poller

#

yep, lets wait until i crashes again, then i can check the logs. Thanks so far.

main axle
#

sure

main axle
dull escarp
#

Poller crashed again, which Log-files you need to take a look on it ?

main axle
dull escarp
main axle
#

Thanks. Could you share Harvest poller logs as well

dull escarp
#

sure, wait

#

are uploaded

main axle
#

As per logs, poller process received SIGTERM . It's something outiside pollers which is causing it to shutdown

time=2025-11-03T22:22:31.812+01:00 level=INFO source=poller.go:680 msg="caught signal" Poller=mcistr0100 signal=terminated
dull escarp
#

network timeouts possible?

main axle
#

Doesn't seem like it.

dull escarp
#

ok that`s good. Do you see any chance to figure out what our issue is?

main axle
#

Checking. It is possible that systemd only is stopping all pollers. It could be that 1 poller process is not able to run so systemd tries to restart all.

dull escarp
#

Thank you very much for your time!

main axle
#

looks like poller mspstr0116 is failing. Is it something new which you have added?

#

And since adding that you are noticing crashes?

dull escarp
#

we added all our clusters at same time

main axle
#

If you check poller_mspstr0116.log
It cann't run due to permission issues. Could you fix its permissions?

#

I see its logs only starting from time=2025-11-03T10:21:35.688+01:00

dull escarp
#

which kind of permissions do you mean?

main axle
#

time=2025-11-03T10:22:04.241+01:00 level=WARN source=poller.go:861 msg="init collector-object" Poller=mspstr0116 error="StatusCode: 401, Error: auth failed, Message: 401 Unauthorized, API: /api/cluster?fields=%2A&return_records=true" collector=RestPerf object=WorkloadVolume

dull escarp
#

so issue with User in ONTAP ?

main axle
#

Yes

dull escarp
#

ok, I check it

main axle
#

Let me check if we can also fix something in systemd behaviour so that it doesn't restart all pollers when 1 crashes

#

once permissions issues are fixed. That should solve the problem.

#

You can also change harvest.target file at location /etc/systemd/system/harvest.target

#

and change Requires to Wants

#

After making this change. Execute below commands

systemctl daemon-reload
systemctl restart harvest.target
systemctl status harvest.target
dull escarp
#

Thank you @main axle in fact the harvest user was missing on our mspstr0116 cluster!

main axle
#

Makes sense. Let's see how system behaves after above fixes.

dull escarp
#

Thank you, I keep my eyes on it and let you know

main axle
#

sure

main axle
dull escarp
#

@main axle is runs stable now. Thank you for your help!

main axle
#

@dull escarp We will do next Harvest release 25.11 probably today/tomorrow. You can wait for that.