Skip to content

Allow to add commandline option, specially -audit #154

Closed

Description

@opensource21

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.

Activity

  1. changed the title [-]How to enable audit-log [/-] [+]Allow to add commandline option, specially -audit[/+] on May 2, 2021
  2. xor-gate commented on May 5, 2021

    @xor-gate
    Member

    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

  3. opensource21 commented on May 5, 2021

    @opensource21
    Author

    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.

  4. xor-gate commented on May 9, 2021

    @xor-gate
    Member

    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 ;-)

  5. opensource21 commented on May 9, 2021

    @opensource21
    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.

  6. xor-gate commented on May 9, 2021

    @xor-gate
    Member

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

  7. xor-gate commented on May 9, 2021

    @xor-gate
    Member

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

  8. luckman212 commented on Nov 8, 2022

    @luckman212
    Contributor

    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.

  9. xor-gate commented on Nov 8, 2022

    @xor-gate
    Member

    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.

  10. locked as off topic and limited conversation to collaborators on Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions