Skip to content

basil/artifactory-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 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

$ uv run artifactory-sql.py -h
usage: artifactory-sql.py [-h] [-o OUTPUT] [-a ASN] [-c CITY]
                          input [input ...]

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

options:
  -h, --help           show this help message and exit
  -o, --output OUTPUT  The name of the SQLite database to create. (default:
                       artifactory.db)
  -a, --asn ASN        Path to the GeoLite2 ASN MaxMind database file.
                       (default: None)
  -c, --city CITY      Path to the GeoLite2 City MaxMind database file.
                       (default: None)

Examples

$ uv run artifactory-sql.py
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.
sqlite> .tables
request_log
sqlite> .mode column
sqlite> .header on
sqlite> .schema request_log
CREATE TABLE request_log(date_timestamp, hash, request_time_ms, request_type, ip, repo, path, size_bytes);
sqlite> SELECT DATETIME(date_timestamp, 'unixepoch'), repo, path, size_bytes FROM request_log 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 request_log 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