1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00
Files
.github
completions
docs
parsers
acpi.md
airport.md
airport_s.md
arp.md
asciitable.md
asciitable_m.md
blkid.md
cef.md
cef_s.md
chage.md
cksum.md
crontab.md
crontab_u.md
csv.md
csv_s.md
date.md
df.md
dig.md
dir.md
dmidecode.md
dpkg_l.md
du.md
email_address.md
env.md
file.md
finger.md
free.md
fstab.md
git_log.md
git_log_s.md
gpg.md
group.md
gshadow.md
hash.md
hashsum.md
hciconfig.md
history.md
hosts.md
id.md
ifconfig.md
ini.md
iostat.md
iostat_s.md
ip_address.md
iptables.md
iso_datetime.md
iw_scan.md
jar_manifest.md
jobs.md
jwt.md
kv.md
last.md
ls.md
ls_s.md
lsblk.md
lsmod.md
lsof.md
lsusb.md
m3u.md
mdadm.md
mount.md
mpstat.md
mpstat_s.md
netstat.md
nmcli.md
ntpq.md
passwd.md
pidstat.md
pidstat_s.md
ping.md
ping_s.md
pip_list.md
pip_show.md
plist.md
postconf.md
proc.md
proc_buddyinfo.md
proc_consoles.md
proc_cpuinfo.md
proc_crypto.md
proc_devices.md
proc_diskstats.md
proc_driver_rtc.md
proc_filesystems.md
proc_interrupts.md
proc_iomem.md
proc_ioports.md
proc_loadavg.md
proc_locks.md
proc_meminfo.md
proc_modules.md
proc_mtrr.md
proc_pagetypeinfo.md
proc_partitions.md
proc_pid_fdinfo.md
proc_pid_io.md
proc_pid_maps.md
proc_pid_mountinfo.md
proc_pid_numa_maps.md
proc_slabinfo.md
proc_softirqs.md
proc_stat.md
proc_swaps.md
proc_uptime.md
proc_version.md
proc_vmallocinfo.md
proc_vmstat.md
proc_zoneinfo.md
ps.md
route.md
rpm_qi.md
rsync.md
rsync_s.md
sfdisk.md
shadow.md
ss.md
stat.md
stat_s.md
sysctl.md
syslog.md
syslog_bsd.md
syslog_bsd_s.md
syslog_s.md
systemctl.md
systemctl_lj.md
systemctl_ls.md
systemctl_luf.md
systeminfo.md
time.md
timedatectl.md
timestamp.md
top.md
top_s.md
tracepath.md
traceroute.md
ufw.md
ufw_appinfo.md
uname.md
universal.md
update_alt_gs.md
update_alt_q.md
upower.md
uptime.md
url.md
vmstat.md
vmstat_s.md
w.md
wc.md
who.md
x509_cert.md
xml.md
xrandr.md
yaml.md
zipinfo.md
lib.md
readme.md
streaming.md
utils.md
jc
man
templates
tests
.gitignore
CHANGELOG
CONTRIBUTING.md
EXAMPLES.md
LICENSE.md
MANIFEST.in
README.md
_config.yml
build-completions.py
build-package.sh
docgen.sh
install.sh
mangen.py
pypi-upload.sh
readmegen.py
requirements.txt
runtests.sh
setup.cfg
setup.py
updatedocs.sh
jc/docs/parsers/rsync.md

161 lines
4.5 KiB
Markdown
Raw Normal View History

2022-02-01 17:57:12 -08:00
[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.rsync"></a>
# jc.parsers.rsync
2022-03-04 13:27:39 -08:00
jc - JSON Convert `rsync` command output parser
2022-02-01 17:57:12 -08:00
Supports the `-i` or `--itemize-changes` options with all levels of
2022-05-26 16:03:30 -07:00
verbosity. This parser will process the `STDOUT` output or a log file
2022-02-14 09:37:37 -08:00
generated with the `--log-file` option.
2022-02-01 17:57:12 -08:00
Usage (cli):
$ rsync -i -a source/ dest | jc --rsync
2022-08-15 13:51:48 -07:00
or
2022-02-01 17:57:12 -08:00
$ jc rsync -i -a source/ dest
2022-08-15 13:51:48 -07:00
or
2022-02-08 14:45:33 -08:00
$ cat rsync-backup.log | jc --rsync
2022-02-01 17:57:12 -08:00
Usage (module):
import jc
result = jc.parse('rsync', rsync_command_output)
Schema:
[
{
"summary": {
"date": string,
"time": string,
"process": integer,
"sent": integer,
"received": integer,
"total_size": integer,
"matches": integer,
"hash_hits": integer,
"false_alarms": integer,
"data": integer,
"bytes_sec": float,
"speedup": float
},
"files": [
{
"filename": string,
"date": string,
"time": string,
"process": integer,
"metadata": string,
2022-05-28 12:41:36 -07:00
"update_type": string/null, # [0]
"file_type": string/null, # [1]
2022-02-01 17:57:12 -08:00
"checksum_or_value_different": bool/null,
"size_different": bool/null,
"modification_time_different": bool/null,
"permissions_different": bool/null,
"owner_different": bool/null,
"group_different": bool/null,
"acl_different": bool/null,
"extended_attribute_different": bool/null,
2022-05-28 12:41:36 -07:00
"epoch": integer, # [2]
2022-02-01 17:57:12 -08:00
}
]
}
]
[0] 'file sent', 'file received', 'local change or creation',
'hard link', 'not updated', 'message'
[1] 'file', 'directory', 'symlink', 'device', 'special file'
[2] naive timestamp if time and date fields exist and can be converted.
Examples:
$ rsync -i -a source/ dest | jc --rsync -p
[
{
"summary": {
"sent": 1708,
"received": 8209,
"bytes_sec": 19834.0,
"total_size": 235,
"speedup": 0.02
},
"files": [
{
"filename": "./",
"metadata": ".d..t......",
"update_type": "not updated",
"file_type": "directory",
"checksum_or_value_different": false,
"size_different": false,
"modification_time_different": true,
"permissions_different": false,
"owner_different": false,
"group_different": false,
"acl_different": false,
"extended_attribute_different": false
},
...
]
}
]
$ rsync | jc --rsync -p -r
[
{
"summary": {
"sent": "1,708",
"received": "8,209",
"bytes_sec": "19,834.00",
"total_size": "235",
"speedup": "0.02"
},
"files": [
{
"filename": "./",
"metadata": ".d..t......",
"update_type": "not updated",
"file_type": "directory",
"checksum_or_value_different": false,
"size_different": false,
"modification_time_different": true,
"permissions_different": false,
"owner_different": false,
"group_different": false,
"acl_different": false,
"extended_attribute_different": false
},
...
]
}
]
<a id="jc.parsers.rsync.parse"></a>
2022-03-05 12:15:14 -08:00
### parse
2022-02-01 17:57:12 -08:00
```python
def parse(data: str, raw: bool = False, quiet: bool = False) -> List[Dict]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
List of Dictionaries. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, freebsd
2022-07-16 20:52:19 -07:00
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)