Strife has shown how to let LSL do the work for you, Cyclopean - Here is a (lengthy) explanation for the maths behind it.
What you're bumping into is one of the difficulties of Euler angles that made me grudginlgy resort to learning quaternions - and now I won't go back

The problem is that as the Xrot is applied (and it is applied first, then Y, and only then Z), it rotates not only the object, but its axes as well. So after the rotation around the x-axiz is performed, the y axis is no longer where it was - it no longer matches the world's y-axis.
So looking at your example:
using EulersRotation around the x-axis is performed first. Assume we are standing south of your cylinder, facing directly N at it. Its rotation is currently world-aligned (<0.0, 0.0, 0.0>

. We want it to end up pointing away from us(positive Y), up(positive Z) and to the right(positive X), but our first rotation must be around the X-axis, which runs from left to right. This means we need to tip the cylinder's top (and its Z axis) back away from us. Right-hand rule tells us that this is negative rotation around X. We want to rotate it so that a point 2.512m horizontally away from the origin will be 1.74m up.
If Theta is the angle between the rotated cylinder and the ground plane then Tan(Theta)=1.74/2.512
Of course, the Z-axis starts vertically, not on the ground plane, so the rotation is actually 90-arctan(1.74/2.512).
But right-hand-rule told us we need negative rotation, so it's actually 360-(90-arctan(1.74/2.512)), which is 304.709 degrees.
Now it would be quite easy to calculate the global Z-rotation needed to spin the object into its final rotation, BUT neither the Y-axis nor the Z-axis are world-aligned anymore. They have both been rotated 304.709 degrees off true. With some fancy trig we could calculate the needed rotation around the object's local Y-axis (ends up being 38.4 degrees), but DAMN! it's tricky. Rather we could look at ...
using QuaternionsQuats, unlike Eulers, perform one co-ordinated rotation, rather than three seperate ones.
They are encoded by taking a normalised axis-of-rotation, multiplying each value by the sin of half of the angle of rotation, and adding the cos of half of the angle as a fourth number.
Don't worry why it is done like this - just remember that if x, y and z are the axis or rotation, and ha is half of the angle of rotation, then the corresponding quat is <x.sin(ha), y.sin(ha), z.sin(ha), cos(ha)>.
The axis of rotation is easy to find in this example. It is perpendicular to the plane of rotation, which passes through the vertical (Z) axis, and passes through the ground plane at <2.424, 2.512, 0.0>. The axis of rotation then is simply the line that passes through the origin and <-2.512, 2.424, 0.0> (because the line-segment <a, b, 0> is always perpendicular to <-b, a, 0>

Normalise (using your calculator, or llVecNorm) <-2.512, 2.424, 0.0> to <-0.72, 0.694, 0.0>
The angle of rotation (around that axis) from the ground plane up is given by arctan(1.74/h) where h is the hypotenuse of the triangle with X=2.424 and Y=2.512. Same as we did with Eulers, subtract that answer from 90 degrees because we are rotating from vertical rather than from the ground plane, and we get 63.506
This basically gives us the answer
float HalfAngle = (63.506 * DEG_TO_RAD) / 2.0;
float Sin = llSin(HalfAngle);
llSetRot( <-0.72*Sin, 0.694*Sin, 0.0, llCos(HalfAngle)> );
I know it takes some getting used to at first, but persevere and you'll soon find quats far easier to work with than Eulers.

If you need elucidation (love that word

) on any of that - or pictures - let me know.