Skip to content

basil/artifactory-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Artifactory SQL

An SQLite interface to Artifactory log files. This program:

  • Imports the log files into an SQLite database.
  • Drops you into an sqlite3(1) shell in that database.

Usage

$ python3 artifactory-sql.py -h
usage: artifactory-sql.py [-h] [-o OUTPUT] input [input ...]

positional arguments:
  input                 The Artifactory log file(s) to parse.

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        The name of the SQLite database to create. (default: artifactory.db)

Examples

$ python3 artifactory-sql.py
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.
sqlite> .tables
logs
sqlite> .mode column
sqlite> .header on
sqlite> .schema logs
CREATE TABLE logs(date_timestamp, hash, request_time_ms, request_type, ip, repo, path, size_bytes);
sqlite> SELECT DATETIME(date_timestamp, 'unixepoch'), repo, path, size_bytes FROM logs ORDER BY size_bytes DESC LIMIT 2;
DATETIME(date_timestamp, 'unixepoch')  repo               path                                                                                                              size_bytes
-------------------------------------  -----------------  ----------------------------------------------------------------------------------------------------------------  ----------
2022-12-31 10:13:08                    jcenter-cache      io/prestosql/presto-server/319/presto-server-319.tar.gz                                                           918994355
2023-01-01 04:05:03                    incrementals       org/jenkins-ci/plugins/aws-java-sdk/1.11.1026-rc242.25123f405d91/aws-java-sdk-1.11.1026-rc242.25123f405d91.hpi    200625409
sqlite> SELECT repo, path, size_bytes, count(path) AS cnt FROM logs GROUP BY path ORDER BY cnt DESC LIMIT 5;
repo               path                                                            size_bytes  cnt
-----------------  --------------------------------------------------------------  ----------  ----
releases           org/jenkins-ci/main/jenkins-war/maven-metadata.xml              25680       4214
releases           org/jenkins-ci/plugins/swarm-client/3.22/swarm-client-3.22.jar  6821342     2345
maven-repo1-cache  last_updated.txt                                                29          1577
releases           org/jenkins-ci/plugins/swarm-client/3.17/swarm-client-3.17.jar  2607496     667
releases           org/jenkins-ci/plugins/swarm-client/3.19/swarm-client-3.19.jar  6714221     602
sqlite>

License

Licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages