splunk/addonfactory-solutions-library-python

collection name to long for "splunk backup kvstore" command

zszia opened this issue · 4 comments

zszia commented

The autogenerated collection name is too long.

Tested with the included solnlib_demo app.
The autogenerated collection is

solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint

If you try to backup the collection:

splunk backup kvstore -archiveName solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint -collectionName solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint -appName solnlib_demo -auth admin:XXXXXX

you get error messages in splunkd.log:
"larger than MAX_PATH"

01-17-2021 17:39:27.875 +0100 INFO  KVStoreBackupRestore - backup started for archiveName="D:\Tools\Splunk\var\lib\splunk\kvstorebackup\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint", app="solnlib_demo", collection="solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint"
01-17-2021 17:39:27.889 +0100 WARN  Pathname - Pathname 'D:\Tools\Splunk\var\lib\splunk\kvstorebackup\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint' larger than MAX_PATH, callers:  call_sites=[0x172c739, 0x173334b, 0xd2096e, 0x3b09214c2, 0x3b1657034, 0x3b2dcd0d1]
01-17-2021 17:39:27.890 +0100 WARN  Pathname - Pathname 'D:\Tools\Splunk\var\lib\splunk\kvstorebackup\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint' larger than MAX_PATH, callers:  call_sites=[0x172c759, 0x173334b, 0xd2096e, 0x3b09214c2, 0x3b1657034, 0x3b2dcd0d1]
01-17-2021 17:39:27.890 +0100 WARN  Pathname - Pathname 'D:\Tools\Splunk\var\lib\splunk\kvstorebackup\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint0.json' larger than MAX_PATH, callers:  call_sites=[0x172c759, 0x173334b, 0xd2096e, 0x3b09214c2, 0x3b1657034, 0x3b2dcd0d1]
01-17-2021 17:39:27.890 +0100 ERROR KVStoreAdminHandler - Could not create a file="D:\Tools\Splunk\var\lib\splunk\kvstorebackup\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint0.json" while backing up collection="solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint"
01-17-2021 17:39:27.890 +0100 ERROR KVStoreBackupRestore - Failed to write out data for collection="solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint": Could not create a file="D:\Tools\Splunk\var\lib\splunk\kvstorebackup\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint\solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint0.json" while backing up collection="solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint"
01-17-2021 17:39:27.890 +0100 WARN  KVStoreBackupRestore - No data found to backup matching specified parameters app="solnlib_demo", collection="solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint"

@aradonds can you look at this

I've checked in locally and I do not have this issue on MacOS. It looks like not a solnlib issue and more like MAX_PATH issue in Windows.

@zszia can you please try something with smaller archiveName, like

splunk backup kvstore -archiveName SolnDemoCollectorCheckpoint -collectionName solnlib_demo_solnlib_demo_collector_test_SolnDemoCollectorCheckpoint -appName solnlib_demo -auth admin:XXXXXX
zszia commented

I tested under Linux and could not reproduce the error. So it's a windows issue with the archiveName.
I'm always using the same name for the archive as the collection name, but will change it for my windows system.