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

Log file a little messy: hard to seek what it's important #12

Open
MilesTEG1 opened this issue Jun 23, 2023 · 0 comments
Open

Log file a little messy: hard to seek what it's important #12

MilesTEG1 opened this issue Jun 23, 2023 · 0 comments

Comments

@MilesTEG1
Copy link

Hello,
I just check the log of the container, and it's really hard to read.

[2023-06-23 20:41:52] time="2023-06-23T20:41:52+02:00" level=info msg="read crontab: /etc/crontabs/vdirsyncer"
[2023-06-23 21:00:00] time="2023-06-23T21:00:00+02:00" level=info msg=starting iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:00] time="2023-06-23T21:00:00+02:00" level=info msg="Discovering collections for pair icloud_calendar_XXX_to_nextcloud" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="xxx_icloud_calendar:" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"Rappels ⚠️\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx"\ (\"iCloud - Pour les Chats 😺\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"iCloud - Personnel\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"Rappels - Famille ⚠️\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"iCloud - Lycée\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"iCloud - Famille\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:01] time="2023-06-23T21:00:01+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"Ecole et Direction_Cécile\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:03] time="2023-06-23T21:00:03+02:00" level=info msg="xxx_nextcloud_calendar:" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:03] time="2023-06-23T21:00:03+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"Rappels - Famille ⚠️\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:03] time="2023-06-23T21:00:03+02:00" level=info msg="  - \"xxxx-xxxx-xxxx-xxxx\" (\"Rappels ⚠️\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"
[2023-06-23 21:00:03] time="2023-06-23T21:00:03+02:00" level=info msg="  - \"home\" (\"iCloud - Personnel\")" channel=stderr iteration=0 job.command="yes | /usr/local/bin/vdirsyncer -c /vdirsyncer/config discover" job.position=0 job.schedule="*/30 * * * *"

There is too much unwanted information for me...

I had made a script to launch the commands for me, on my mac, checking if the binaries are installed, and here a portion of the log I get:

[2023-06-23 21:30:37] ---- Début des commandes vdirsyncer du jour ----
[2023-06-23 21:30:37]      --> Synchronisation pour MOI :
[2023-06-23 21:30:37]            --   AUTO_DISCOVER est à true :
[2023-06-23 21:30:37]                --   Discovering collections for pair icloud_calendar_XYZ_to_nextcloud
[2023-06-23 21:30:38]                --   xyz_icloud_calendar:
[2023-06-23 21:30:38]                --     - "xxxx-xxxx-xxxx-xxxx" ("Rappels ⚠️")
[2023-06-23 21:30:38]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - XYZ")
[2023-06-23 21:30:38]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - Personnel")
[2023-06-23 21:30:38]                --     - "xxxx-xxxx-xxxx-xxxx" ("Rappels - Famille ⚠️")
[2023-06-23 21:30:38]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - Famille")
[2023-06-23 21:30:38]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - Pour les Chats 😺")
[2023-06-23 21:30:39]                --     - "xxxx-xxxx-xxxx-xxxx" ("Ecole et XYZ-XYZ")
[2023-06-23 21:30:39]                --   xyz_nextcloud_calendar:
[2023-06-23 21:30:39]                --     - "xxxx-xxxx-xxxx-xxxx" ("Rappels - Famille ⚠️")
[2023-06-23 21:30:40]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - XYZ")
[2023-06-23 21:30:40]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - Pour les Chats 😺")
[2023-06-23 21:30:40]                --     - "xxxx-xxxx-xxxx-xxxx" ("Ecole et XYZ-XYZ")
[2023-06-23 21:30:40]                --     - "xxxx-xxxx-xxxx-xxxx" ("Rappels ⚠️")
[2023-06-23 21:30:40]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - Personnel")
[2023-06-23 21:30:40]                --     - "xxxx-xxxx-xxxx-xxxx" ("iCloud - Famille")
[2023-06-23 21:30:40]                --   Saved for icloud_calendar_XYZ_to_nextcloud: collections = ["iCloud_Lycee", "iCloud_chats", "iCloud_Personnel", "iCloud_Famille", "Rappels", "Rappels_Famille", "xyz-XYZ-xyz"]
[2023-06-23 21:30:40]            --   Metasyncing icloud_calendar_XYZ_to_nextcloud/iCloud_Lycee
[2023-06-23 21:30:40]            --   Metasyncing icloud_calendar_XYZ_to_nextcloud/iCloud_chats
[2023-06-23 21:30:40]            --   Metasyncing icloud_calendar_XYZ_to_nextcloud/iCloud_Personnel
[2023-06-23 21:30:40]            --   Metasyncing icloud_calendar_XYZ_to_nextcloud/iCloud_Famille
[2023-06-23 21:30:40]            --   Metasyncing icloud_calendar_XYZ_to_nextcloud/Rappels
[2023-06-23 21:30:40]            --   Metasyncing icloud_calendar_XYZ_to_nextcloud/Rappels_Famille
[2023-06-23 21:30:40]            --   Metasyncing icloud_calendar_XYZ_to_nextcloud/xyz-XYZ-xyz
[2023-06-23 21:30:43]            --   Syncing icloud_calendar_XYZ_to_nextcloud/iCloud_Lycee
[2023-06-23 21:30:43]            --   Syncing icloud_calendar_XYZ_to_nextcloud/iCloud_chats
[2023-06-23 21:30:43]            --   Syncing icloud_calendar_XYZ_to_nextcloud/iCloud_Personnel
[2023-06-23 21:30:43]            --   Syncing icloud_calendar_XYZ_to_nextcloud/iCloud_Famille
[2023-06-23 21:30:43]            --   Syncing icloud_calendar_XYZ_to_nextcloud/Rappels
[2023-06-23 21:30:43]            --   Syncing icloud_calendar_XYZ_to_nextcloud/Rappels_Famille
[2023-06-23 21:30:43]            --   Syncing icloud_calendar_XYZ_to_nextcloud/xyz-XYZ-xyz
[2023-06-23 21:30:44]      --> Fin de la synchronisatinon pour MOI.

Here a portion of what generate the log (I was greatly inspired by your work for the ts and tee commands ^^ except I use touch instead of curl to create the logfile.)

for user in "${user_list[@]}"; do
    config_full_path="${config_path}/config_${user}"
    printf "     --> Synchronisation pour %s :\n" "${user}" 2>&1 | ts '[%Y-%m-%d %H:%M:%S]' | tee -a "${LOG_FILE}"

    # Commande à lancer manuellement dans un terminal :
    #           vdirsyncer -v INFO --config ~/"Gitea/Scripts--Powershell-et-Bash-ZSH/Scripts-macOS/Vdirsyncer-configs/config_ME" discover      /// metasync | sync
    #           vdirsyncer -v INFO --config ~/"Gitea/Scripts--Powershell-et-Bash-ZSH/Scripts-macOS/Vdirsyncer-configs/config_HER" discover     /// metasync | sync
    if [[ "${AUTO_DISCOVER}" == "true" ]]; then
        printf "AUTO_DISCOVER est à true :\n" 2>&1         | ts "[%Y-%m-%d %H:%M:%S]            --  " | tee -a "${LOG_FILE}"
        vdirsyncer -v INFO --config "${config_full_path}" discover  2>&1    | ts "[%Y-%m-%d %H:%M:%S]                --  " | tee -a "${LOG_FILE}"
    fi
    vdirsyncer -v INFO --config "${config_full_path}" metasync  2>&1    | ts "[%Y-%m-%d %H:%M:%S]            --  " | tee -a "${LOG_FILE}"
    vdirsyncer -v INFO --config "${config_full_path}" sync 2>&1         | ts "[%Y-%m-%d %H:%M:%S]            --  " | tee -a "${LOG_FILE}"
    printf "     --> Fin de la synchronisation pour %s.\n" "${user}" 2>&1 | ts '[%Y-%m-%d %H:%M:%S]' | tee -a "${LOG_FILE}"
done

If you could do something, it would be great. And I can get put definitively vdirsyncer on my NAS with docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant