Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to add commandline option, specially -audit #154

Closed
opensource21 opened this issue May 2, 2021 · 8 comments
Closed

Allow to add commandline option, specially -audit #154

opensource21 opened this issue May 2, 2021 · 8 comments

Comments

@opensource21
Copy link

opensource21 commented May 2, 2021

On commandline I can set -audit to get audit-log files. It seems impossible for syncthing-macos.
Since the ui only works with embedded syncthing, I don't see any workaroung.

@opensource21 opensource21 changed the title How to enable audit-log Allow to add commandline option, specially -audit May 2, 2021
@xor-gate
Copy link
Member

xor-gate commented May 5, 2021

Hi @opensource21, this is currently not possible to inject custom command-line parameters. What you could do is run syncthing from the terminal application on the commandline directly /Applications/Syncthing.app/Contents/Resources/syncthing/syncthing.

First you need to stop it from the tray icon menu:
Screenshot 2021-05-05 at 17 48 18

@opensource21
Copy link
Author

opensource21 commented May 5, 2021

Thanks for the hint. I choose the following workaround.
In folder
cd /Applications/Syncthing.app/Contents/Resources/syncthing/
Rename the original file
mv syncthing syncthing.org
Created a file mysyncthing.sh

echo "#!/bin/zsh" > mysyncthing.sh
echo "/Applications/Syncthing.app/Contents/Resources/syncthing/syncthing.org -audit $@" >> mysyncthing.sh
chmod a+x mysyncthing.sh

and create a link
ln mysyncthing.sh syncthing

So I can be sure to always has audit enabled.
The audit-files can be found at ~/Library/Application Support/Syncthing/.

Only drawback: At each update I need to call

mv  /Applications/Syncthing.app/Contents/Resources/syncthing/syncthing 	/Applications/Syncthing.app/Contents/Resources/syncthing/syncthing.org 
ln /Applications/Syncthing.app/Contents/Resources/syncthing/syncthing /Applications/Syncthing.app/Contents/Resources/syncthing/mysyncthing.sh

So I would really appreciate if you can make possibility to a permanent customization.

@xor-gate
Copy link
Member

xor-gate commented May 9, 2021

Dear @opensource21,

As requested I added (preliminary) support for adding "power user" arguments to syncthing. It is currently a hidden feature which is not available from the GUI because I have a not enough experience programming in Swift/Objective C and using XCode Interface Builder.

You can download a v1.16.1-2 release from https://build.syncthing.net/repository/download/SyncthingMacOS_BuildReleaseDmg/101990:id/Syncthing-1.16.1-2.dmg

And you should set the arguments from terminal this way:

defaults write com.github.xor-gate.syncthing-macosx Arguments '--audit --auditfile=/Users/jerry/staudtifilefromcfg.log'

See also the above commit.

Please let me know if it works for you. And consider donating my hard work ;-)

@opensource21
Copy link
Author

Works like a charm. Perfect solution in my eyes. I think persons who want this feature, will read the Readme.md and will be happy. I had tried to change the executable in defaults, but it can't be changed.

Thanks for your work. For me the issue can be closed.

@xor-gate
Copy link
Member

xor-gate commented May 9, 2021

The executable in the defaults is an old/deprecated feature. So yes this is not working (anymore). Have fun!

@xor-gate xor-gate closed this as completed May 9, 2021
@xor-gate
Copy link
Member

xor-gate commented May 9, 2021

I have released v1.16.1-2 which is the addition of this feature request.

@luckman212
Copy link

Just adding this note here related to debugging going on over at https://forum.syncthing.net/t/com-apple-provenance/19262/17

For anyone who wants to increase the logfile size using the macOS bundle, you can use:

# sets logfile size to 50MB, and keep the last 5 during logrotate 
defaults write com.github.xor-gate.syncthing-macosx Arguments '--log-max-size=52428800 --log-max-old-files=5'

And when you're done debugging, use this to revert things back to default:

defaults delete com.github.xor-gate.syncthing-macosx Arguments

I believe you need to fully quit the Syncthing app after each of these changes (not just stop/start the service) for it to take effect.

@xor-gate
Copy link
Member

xor-gate commented Nov 8, 2022

Commenting on your findings:

I believe you need to fully quit the Syncthing app after each of these changes (not just stop/start the service) for it to take effect.

Yes the Arguments are loaded only on startup. Not when changed.

@syncthing syncthing locked as off-topic and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants