You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently have a batch job that runs every minute and the stdout is redirected to a new file. We have scalyr-agent installed and if I were to use bash's >> to append to the log file, scalyr-agent works fine.
I wanted to use >, that way I don't have to worry about log rotation, scalyr-agent would have 60 seconds to detect that the file changed and send it to scalyr. Another fun option would be able to pipe my bash output right into the running scalyr, ex * * * * * update-app.sh | /usr/local/scalyr-agent-2/bin/scalyr-agent-2
Is there a setting or a new feature that would allow the scalyr-agent to detect a file replace?
From scalyr-agent-2 -v status
/var/cron/logs/auto_update.log: copied 135 bytes (1 lines), 0 bytes pending, last checked Wed Mar 13 15:44:39 2019 UTC
Thanks for reaching out! From a high level, it seems as if you are looking for a way to run this cron job, write the output to a file, and not have to manage the rotation of the file.
The agent doesn't directly support rotating logs, and there is no setting to make the agent handle the IO Redirection option ">", but there are two solutions I can think of:
As one of our engineers @johnpadilla pointed out, you can try this. rm /var/cron/logs/auto_update.log; update-app.sh >> /var/cron/logs/auto_update.log 2>&1
Use the API in your shell script to post the logline. This would allow you to send the log directly to your Scalyr account, bypassing the file altogether.
Hello,
I currently have a batch job that runs every minute and the stdout is redirected to a new file. We have scalyr-agent installed and if I were to use bash's
>>
to append to the log file, scalyr-agent works fine.I wanted to use
>
, that way I don't have to worry about log rotation, scalyr-agent would have 60 seconds to detect that the file changed and send it to scalyr. Another fun option would be able to pipe my bash output right into the running scalyr, ex* * * * * update-app.sh | /usr/local/scalyr-agent-2/bin/scalyr-agent-2
Is there a setting or a new feature that would allow the scalyr-agent to detect a file replace?
From
scalyr-agent-2 -v status
From data/checkpoints.json
crontab -l
/var/cron/logs/auto_update.log
The text was updated successfully, but these errors were encountered: