Reddit DevOps
278 subscribers
70 photos
32.2K links
Reddit DevOps. #devops
Thanks @reddit2telegram and @r_channels
Download Telegram
Docker log forwarding container of docker logs to Sumo Logic

Tried a fluentd container with the following configuration:


<source>
@type tail
path /var/lib/docker/containers/*/*.log
time_format %Y-%m-%dT%H:%M:%S
tag docker.*
format json
read_from_head true
# read_lines_limit 250
</source>

<match *>
@type sumologic
endpoint xxxxxxx
log_format json
#source_category xxxxx
#source_name xxxxx
open_timeout 10
</match>

but this doesn't work (the container starts fine and runs as normal but nothing). The same configuration for a local systemctl service works and sends but for some reason is not working as a container (the container has access & permission to logs)

&#x200B;

Any ideas?

https://redd.it/dfk8jw
@r_devops
Sonatype Nexus search api does not return all the artifacts

We use sonatype nexus OSS 3.14.0-04 to store all our artifacts and we use Jenkins as our CI/CD took. I introduced snapshot support recently. From Jenkins I use the below groovy script to fetch all artifact versions and populate an Active choice drop-down:

&#x200B;

`#!/usr/bin/env groovy`

`import groovy.json.JsonSlurper`

&#x200B;

`#source can be "snapshot" or "release". - source is an Active choice parameter with these two options. I read from the source field.`



`def url = "https://<<<nexus-host>>>/service/rest/v1/search?repository=maven-" + source + "s&`[`maven.groupId=com.xyz`](https://maven.groupId=com.xyz)`&maven.artifactId=rader"`

`def xml = url.toURL().text`

`JsonSlurper parser = new groovy.json.JsonSlurper()`

`Map parsedJson = parser.parseText(xml)`

`def versions = parsedJson.items.version`

&#x200B;

`if (source.equalsIgnoreCase('snapshot')) {`

`Set<String> modVersion = new HashSet<>()`

`for (def item : versions) {`

`modVersion.add(item.split("-").getAt(0) + "-SNAPSHOT")`

`}`

&#x200B;

`return new ArrayList<>(modVersion).sort()`

`} else {`

`return versions.reverse()`

`}`

&#x200B;

The problem is, this does not always return all the artifacts both in snapshot and release. I have to go and delete some older artifacts to make the newer ones appear on the list.

I do not see anything suspicious in the log and not sure how to proceed to troubleshoot this. Is there a better way of achieving the same? Any pointer would be highly appreciated.

https://redd.it/e6c0tb
@r_devops